From 73cb1e613e795a0895169b9565626f4bd0396b55 Mon Sep 17 00:00:00 2001 From: Sebastian Spaar Date: Mon, 12 Jan 2026 12:29:24 +0100 Subject: [PATCH 1/3] Properly set and unset `_replotting` flag during scroll event This is set to `false` in `zoomWheel`'s redrawTimer, but a corresponding set to `true` was missing. --- src/plots/cartesian/dragbox.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plots/cartesian/dragbox.js b/src/plots/cartesian/dragbox.js index f8fa211ad8f..abbc2c92f27 100644 --- a/src/plots/cartesian/dragbox.js +++ b/src/plots/cartesian/dragbox.js @@ -528,6 +528,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // viewbox redraw at first + gd._fullLayout._replotting = true; updateSubplots(scrollViewBox); ticksAndAnnotations(); From f340b250cc1fa185f85cdc92087061ea2e1f0452 Mon Sep 17 00:00:00 2001 From: Sebastian Spaar Date: Tue, 3 Feb 2026 20:26:08 +0900 Subject: [PATCH 2/3] dragbox: Add early return when scrolling multiple subplots This prevents multiple subplots from firing their `setTimeout` callback which otherwise leads to erratic jumps in the plots when scrolling/zooming with the mouse while moving it at the same time. --- src/plots/cartesian/dragbox.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plots/cartesian/dragbox.js b/src/plots/cartesian/dragbox.js index abbc2c92f27..5aca52ce337 100644 --- a/src/plots/cartesian/dragbox.js +++ b/src/plots/cartesian/dragbox.js @@ -38,6 +38,9 @@ var MINZOOM = constants.MINZOOM; // flag for showing "doubleclick to zoom out" only at the beginning var SHOWZOOMOUTTIP = true; +// Current (sub)plot that initiated a scroll +let CURRENT_SCROLLING_SUBPLOT = null; + // dragBox: create an element to drag one or more axis ends // inputs: // plotinfo - which subplot are we making dragboxes on? @@ -467,6 +470,15 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { return; } + if (CURRENT_SCROLLING_SUBPLOT == null) { + CURRENT_SCROLLING_SUBPLOT = plotinfo.id; + } + // Early exit to prevent jitters if this subplot didn't initiate the scroll + if (CURRENT_SCROLLING_SUBPLOT !== plotinfo.id) { + e.preventDefault(); + return; + } + clearAndResetSelect(); // If a transition is in progress, then disable any behavior: @@ -538,6 +550,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { // no more scrolling is coming redrawTimer = setTimeout(function() { if(!gd._fullLayout) return; + CURRENT_SCROLLING_SUBPLOT = null; scrollViewBox = [0, 0, pw, ph]; dragTail(); }, REDRAWDELAY); From c297b51dda6c7d3f88af1c418aa39e9fb982d617 Mon Sep 17 00:00:00 2001 From: Eroica Date: Fri, 6 Feb 2026 09:28:10 +0900 Subject: [PATCH 3/3] Draft log for #7704 --- draftlogs/7704_fix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 draftlogs/7704_fix.md diff --git a/draftlogs/7704_fix.md b/draftlogs/7704_fix.md new file mode 100644 index 00000000000..c7672c90c18 --- /dev/null +++ b/draftlogs/7704_fix.md @@ -0,0 +1 @@ +- Fix visual jumps when zooming/scrolling through plots [[#7704](https://github.com/plotly/plotly.js/pull/7704)]