pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/plotly/plotly.js/pull/7704/files

https://github.githubassets.com/assets/primer-primitives-10bf9dd67e3d70bd.css" /> Fix for removing erratic jittering during scrolling/zooming by Eroica · Pull Request #7704 · plotly/plotly.js · GitHub
Skip to content
1 change: 1 addition & 0 deletions draftlogs/7704_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix visual jumps when zooming/scrolling through plots [[#7704](https://github.com/plotly/plotly.js/pull/7704)]
15 changes: 14 additions & 1 deletion src/plots/cartesian/dragbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,16 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
return;
}

// Store (sub)plot that initiated a scroll
if (gd._currentScrollingSubplot == null) {
gd._currentScrollingSubplot = plotinfo.id;
}
// Early exit to prevent jitters if this subplot didn't initiate the scroll
if (gd._currentScrollingSubplot !== plotinfo.id) {
e.preventDefault();
return;
}

clearAndResetSelect();

// If a transition is in progress, then disable any behavior:
Expand Down Expand Up @@ -499,7 +509,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
var axRange = Lib.simpleMap(ax.range, ax.r2l);
var v0 = axRange[0] + (axRange[1] - axRange[0]) * centerFraction;
function doZoom(v) { return ax.l2r(v0 + (v - v0) * zoom); }
ax.range = axRange.map(doZoom);
ax.range = ax._input.range = axRange.map(doZoom);
ax.setScale();
}

if(editX) {
Expand Down Expand Up @@ -528,6 +539,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
}

// viewbox redraw at first
gd._fullLayout._replotting = true;
updateSubplots(scrollViewBox);
ticksAndAnnotations();

Expand All @@ -537,6 +549,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
// no more scrolling is coming
redrawTimer = setTimeout(function() {
if(!gd._fullLayout) return;
gd._currentScrollingSubplot = null;
scrollViewBox = [0, 0, pw, ph];
dragTail();
}, REDRAWDELAY);
Expand Down
1 change: 1 addition & 0 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,7 @@ plots.purge = function(gd) {
delete gd._editing;
delete gd._mouseDownTime;
delete gd._legendMouseDownTime;
delete gd._currentScrollingSubplot;

// remove all event listeners
if(gd.removeAllListeners) gd.removeAllListeners();
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy