diff --git a/src/components/Viewfinder.tsx b/src/components/Viewfinder.tsx index 47ea4aa..8afc95f 100644 --- a/src/components/Viewfinder.tsx +++ b/src/components/Viewfinder.tsx @@ -1349,7 +1349,25 @@ const Viewfinder = forwardRef(function Viewfi // WATERMARK tab open: two fingers scale the mark under them (or do // nothing) — the photo itself only zooms once the editor is closed. if (ts.length >= 2 && wmEditing) { - const p = wmPinchRef.current; + // The second finger normally lands on its own, so the START handler never + // saw the pair and wmPinchRef is still null -- which is why pinching a + // mark worked on the camera (that path seeds here) but not in the library + // editor. Seed the baseline the same way. + let p = wmPinchRef.current; + if (!p) { + const tgt = wmTargetAt( + (ts[0].locationX + ts[1].locationX) / 2, + (ts[0].locationY + ts[1].locationY) / 2 + ); + if (tgt) { + p = { + tgt, + d: Math.hypot(ts[0].locationX - ts[1].locationX, ts[0].locationY - ts[1].locationY), + size: wmSizeOf(tgt), + }; + wmPinchRef.current = p; + } + } if (p) { const d = Math.hypot(ts[0].locationX - ts[1].locationX, ts[0].locationY - ts[1].locationY); applyWmScale(p.tgt, (p.size * d) / Math.max(p.d, 1));