Skip to content

Commit 6c60a32

Browse files
committed
short-sircuit image redraw during drags
1 parent d9a8ab7 commit 6c60a32

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/plots/cartesian/dragbox.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -562,13 +562,15 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
562562
Axes.doTicks(gd, activeAxIds[i], true);
563563
}
564564

565-
function redrawObjs(objArray, method) {
565+
function redrawObjs(objArray, method, shortCircuit) {
566566
for(i = 0; i < objArray.length; i++) {
567567
var obji = objArray[i];
568568

569569
if((ew && activeAxIds.indexOf(obji.xref) !== -1) ||
570570
(ns && activeAxIds.indexOf(obji.yref) !== -1)) {
571571
method(gd, i);
572+
// once is enough for images (which doesn't use the `i` arg anyway)
573+
if(shortCircuit) return;
572574
}
573575
}
574576
}
@@ -578,7 +580,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
578580

579581
redrawObjs(fullLayout.annotations || [], Registry.getComponentMethod('annotations', 'drawOne'));
580582
redrawObjs(fullLayout.shapes || [], Registry.getComponentMethod('shapes', 'drawOne'));
581-
redrawObjs(fullLayout.images || [], Registry.getComponentMethod('images', 'draw'));
583+
redrawObjs(fullLayout.images || [], Registry.getComponentMethod('images', 'draw'), true);
582584
}
583585

584586
function doubleClick() {

0 commit comments

Comments
 (0)