You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to modify the default double click behavior so it zooms in to the max on double click and then zooms all the way back out on double click. I added var isZoomedIn = false; in the main panzoom.js file on line 119,
Then with the function onDoubleClick on line 765 we can do
function onDoubleClick(e) {
beforeDoubleClick(e);
var offset = getOffsetXY(e);
if (transformOrigin) {
offset = getTransformOriginOffset();
}
var defaultZoom = 0.7; // Replace with your default zoom level
var maxZoom = 100; // Replace with your maximum zoom level
var currentScale = transform.scale;
if (!isZoomedIn) {
smoothZoom(offset.x, offset.y, maxZoom / currentScale);
isZoomedIn = true;
} else {
smoothZoom(offset.x, offset.y, defaultZoom / currentScale);
isZoomedIn = false;
}
}
Please, anyone knows how to zoom in (to the max) and then zoom out (to the min) using onDoubleClick?
Thank you very much
The text was updated successfully, but these errors were encountered: