Skip to content

Commit

Permalink
Scroll position in zooming.
Browse files Browse the repository at this point in the history
  • Loading branch information
dariuszdawidowski committed Sep 9, 2024
1 parent 9a8dff4 commit 3352ef2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions editor/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};
Expand All @@ -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
Expand Down

0 comments on commit 3352ef2

Please sign in to comment.