@@ -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