-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset updates object on every zoomDone #3028
Conversation
- so that 'old' keys from two-sided zoomboxes don't trickle into single-side zoombox updates
@@ -386,6 +385,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) { | |||
} | |||
|
|||
function zoomDone() { | |||
updates = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the same updates
object is also "reset" in
plotly.js/src/plots/cartesian/dragbox.js
Lines 598 to 647 in 7c03fb4
// Draw ticks and annotations (and other components) when ranges change. | |
// Also records the ranges that have changed for use by update at the end. | |
function ticksAndAnnotations(ns, ew) { | |
var activeAxIds = [], | |
i; | |
function pushActiveAxIds(axList) { | |
for(i = 0; i < axList.length; i++) { | |
if(!axList[i].fixedrange) activeAxIds.push(axList[i]._id); | |
} | |
} | |
if(editX) { | |
pushActiveAxIds(xaxes); | |
pushActiveAxIds(links.xaxes); | |
} | |
if(editY) { | |
pushActiveAxIds(yaxes); | |
pushActiveAxIds(links.yaxes); | |
} | |
updates = {}; | |
for(i = 0; i < activeAxIds.length; i++) { | |
var axId = activeAxIds[i]; | |
doTicksSingle(gd, axId, true); | |
var ax = getFromId(gd, axId); | |
updates[ax._name + '.range[0]'] = ax.range[0]; | |
updates[ax._name + '.range[1]'] = ax.range[1]; | |
} | |
function redrawObjs(objArray, method, shortCircuit) { | |
for(i = 0; i < objArray.length; i++) { | |
var obji = objArray[i]; | |
if((ew && activeAxIds.indexOf(obji.xref) !== -1) || | |
(ns && activeAxIds.indexOf(obji.yref) !== -1)) { | |
method(gd, i); | |
// once is enough for images (which doesn't use the `i` arg anyway) | |
if(shortCircuit) return; | |
} | |
} | |
} | |
// annotations and shapes 'draw' method is slow, | |
// use the finer-grained 'drawOne' method instead | |
redrawObjs(gd._fullLayout.annotations || [], Registry.getComponentMethod('annotations', 'drawOne')); | |
redrawObjs(gd._fullLayout.shapes || [], Registry.getComponentMethod('shapes', 'drawOne')); | |
redrawObjs(gd._fullLayout.images || [], Registry.getComponentMethod('images', 'draw'), true); | |
} |
which is called on pan and scroll.
Thanks for the quick work! 💃 |
... so that 'old' keys from two-sided zoomboxes don't trickle into single-side zoombox updates.
Fixes #3026, which was made apparent staring from
v1.40.0
(and PR #2823), as we no longer run acalc
edit when autoranging cartesian axes (e.g on double-click).This one is fairly bad bug, so I'll make a release as soon as this thing is merged.
cc @alexcjohnson @antoinerg