fix(wm): let the library editor pinch a watermark mark
onLibTouchStart only recorded the pinch baseline when both fingers arrived in the same touch-start, so a second finger landing later (the normal case) left wmPinchRef null and the move handler scaled nothing -- pinch-the-mark worked on the camera viewfinder but not on a library photo. Seed the baseline in the move handler, as the camera path already does.
This commit is contained in:
@@ -1349,7 +1349,25 @@ const Viewfinder = forwardRef<ViewfinderHandle, ViewfinderProps>(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));
|
||||
|
||||
Reference in New Issue
Block a user