diff --git a/harnesses/gtauri/frontend/dist/index.html b/harnesses/gtauri/frontend/dist/index.html index a6e97bd..eccc433 100644 --- a/harnesses/gtauri/frontend/dist/index.html +++ b/harnesses/gtauri/frontend/dist/index.html @@ -573,15 +573,29 @@ function commitTo(ni, delta) { if (t < 1) { tween = { raf: requestAnimationFrame(step), commit: true }; } else { - // vimg2 (incoming) is exactly at 0: it becomes primary. const id = ids[ni]; - vimg.src = vimg2.src; // cached + decoded → paints immediately - vTx = 0; - applyTransform(); tween = null; - openViewer(id, true); - // Hide the outgoing preview only once the primary has the bytes. - vimg.onload = () => { if (viewerId === id) navHide(); }; + if (nav && nav.id === id && nav.ready) { + // vimg2 (incoming) is exactly at 0: it becomes primary. Adopt + // its dimensions NOW — otherwise the new pixels render in the + // OLD image's width/height box (wrong aspect) until full-res + // lands and fitViewer() fixes it (visible stretch → snap). + const nw = nav.w, nh = nav.h, ns = nav.scale; + vimg.src = vimg2.src; // cached + decoded → paints immediately + base.w = nw; base.h = nh; + vScale = ns; + vimg.style.width = nw + "px"; + vimg.style.height = nh + "px"; + vTx = 0; vTy = 0; + applyTransform(); + openViewer(id, true); + // Hide the preview only once the primary has the bytes. + vimg.onload = () => { if (viewerId === id) navHide(); }; + } else { + // Preview never made it (keyboard nav / slow thumb): plain + // open — the thumb round-trip sets the right dimensions. + openViewer(id, false); + } } }; tween = { raf: requestAnimationFrame(step), commit: true };