From 3352ef24f3b3764ef1dc10a5203b2617849455ef Mon Sep 17 00:00:00 2001 From: Dariusz Dawidowski Date: Mon, 9 Sep 2024 11:15:23 +0200 Subject: [PATCH] Scroll position in zooming. --- editor/navigator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor/navigator.js b/editor/navigator.js index be43c43..e35f059 100644 --- a/editor/navigator.js +++ b/editor/navigator.js @@ -188,7 +188,7 @@ class MetavizNavigatorBrowser { // Pan if not SHIFT (for native text scrolling) if (!metaviz.editor.keyboard.key.shift) { event.preventDefault(); - metaviz.render.zoom(event.pageX, event.pageY, event.deltaY, metaviz.system.browser.zoomFactor); + metaviz.render.zoom(event.pageX - window.scrollX, event.pageY - window.scrollY, event.deltaY, metaviz.system.browser.zoomFactor); metaviz.editor.cage.update(); } }; @@ -200,7 +200,7 @@ class MetavizNavigatorBrowser { event.preventDefault(); // Pinch if (event.ctrlKey) { - metaviz.render.zoom(event.pageX, event.pageY, event.deltaY, metaviz.system.browser.pinchFactor); + metaviz.render.zoom(event.pageX - window.scrollX, event.pageY - window.scrollY, event.deltaY, metaviz.system.browser.pinchFactor); metaviz.editor.cage.update(); } // Swipe