Skip to content

Commit d3c0214

Browse files
committed
update has** optimization flags on mousedown
... as opposed to on every mousemove.
1 parent 09647f1 commit d3c0214

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/plots/cartesian/dragbox.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
8282
var isSubplotConstrained;
8383
// do we need to edit x/y ranges?
8484
var editX, editY;
85+
// graph-wide optimization flags
86+
var hasScatterGl, hasOnlyLargeSploms, hasSplom, hasSVG;
8587

8688
function recomputeAxisLists() {
8789
xa0 = plotinfo.xaxis;
@@ -117,6 +119,12 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
117119
isSubplotConstrained = links.isSubplotConstrained;
118120
editX = ew || isSubplotConstrained;
119121
editY = ns || isSubplotConstrained;
122+
123+
var fullLayout = gd._fullLayout;
124+
hasScatterGl = fullLayout._has('scattergl');
125+
hasOnlyLargeSploms = fullLayout._hasOnlyLargeSploms;
126+
hasSplom = hasOnlyLargeSploms || fullLayout._has('splom');
127+
hasSVG = fullLayout._has('svg');
120128
}
121129

122130
recomputeAxisLists();
@@ -696,14 +704,6 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
696704
var fullLayout = gd._fullLayout;
697705
var plotinfos = fullLayout._plots;
698706
var subplots = fullLayout._subplots.cartesian;
699-
700-
// TODO can we move these to outer scope?
701-
var hasScatterGl = fullLayout._has('scattergl');
702-
var hasOnlyLargeSploms = fullLayout._hasOnlyLargeSploms;
703-
var hasSplom = hasOnlyLargeSploms || fullLayout._has('splom');
704-
var hasSVG = fullLayout._has('svg');
705-
var hasDraggedPts = fullLayout._has('draggedPts');
706-
707707
var i, sp, xa, ya;
708708

709709
if(hasSplom || hasScatterGl) {

0 commit comments

Comments
 (0)