Skip to content

Commit ba83300

Browse files
Merge pull request #4082 from IgorA100/patch-151
Fix: If "opts.focal" - calculate coordinates taking into account the planned Scale, and not just the calculated Scale (jquery.panzoom.js)
2 parents 9a87e29 + 54d363b commit ba83300

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

web/skins/classic/assets/jquery.panzoom/dist/jquery.panzoom.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@
573573
if (!opts.force && opts.disableZoom) {
574574
return;
575575
}
576+
const toScalePlanned = toScale;
576577
toScale = result.scale;
577578
var toX = x;
578579
var toY = y;
@@ -581,8 +582,8 @@
581582
// plus the current translation after the scale
582583
// neutralized to no scale (as the transform scale will apply to the translation)
583584
var focal = opts.focal;
584-
toX = (focal.x / toScale - focal.x / scale + x * toScale) / toScale;
585-
toY = (focal.y / toScale - focal.y / scale + y * toScale) / toScale;
585+
toX = (focal.x / toScale - focal.x / scale + x * toScalePlanned) / toScalePlanned;
586+
toY = (focal.y / toScale - focal.y / scale + y * toScalePlanned) / toScalePlanned;
586587
}
587588
var panResult = constrainXY(toX, toY, toScale, { relative: false, force: true });
588589
x = panResult.x;

0 commit comments

Comments
 (0)