Skip to content

Commit b0b68a7

Browse files
committed
use redrawReglTraces on drag
1 parent b780dde commit b0b68a7

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

src/plots/cartesian/dragbox.js

+11-15
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ var supportsPassive = require('has-passive-events');
1616
var Registry = require('../../registry');
1717
var Lib = require('../../lib');
1818
var svgTextUtils = require('../../lib/svg_text_utils');
19-
var clearGlCanvases = require('../../lib/clear_gl_canvases');
2019
var Color = require('../../components/color');
2120
var Drawing = require('../../components/drawing');
2221
var Fx = require('../../components/fx');
2322
var setCursor = require('../../lib/setcursor');
2423
var dragElement = require('../../components/dragelement');
2524
var FROM_TL = require('../../constants/alignment').FROM_TL;
25+
var clearGlCanvases = require('../../lib/clear_gl_canvases');
26+
var redrawReglTraces = require('../../plot_api/subroutines').redrawReglTraces;
2627

2728
var Plots = require('../plots');
2829

@@ -84,7 +85,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
8485
// do we need to edit x/y ranges?
8586
var editX, editY;
8687
// graph-wide optimization flags
87-
var hasScatterGl, hasOnlyLargeSploms, hasSplom, hasSVG;
88+
var hasScatterGl, hasSplom, hasSVG;
8889
// collected changes to be made to the plot by relayout at the end
8990
var updates;
9091

@@ -125,8 +126,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
125126

126127
var fullLayout = gd._fullLayout;
127128
hasScatterGl = fullLayout._has('scattergl');
128-
hasOnlyLargeSploms = fullLayout._hasOnlyLargeSploms;
129-
hasSplom = hasOnlyLargeSploms || fullLayout._has('splom');
129+
hasSplom = fullLayout._has('splom');
130130
hasSVG = fullLayout._has('svg');
131131
}
132132

@@ -744,33 +744,29 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
744744
var subplots = fullLayout._subplots.cartesian;
745745
var i, sp, xa, ya;
746746

747-
if(hasSplom || hasScatterGl) {
748-
clearGlCanvases(gd);
749-
}
750-
751747
if(hasSplom) {
752748
Registry.subplotsRegistry.splom.drag(gd);
753-
if(hasOnlyLargeSploms) return;
754749
}
755750

756751
if(hasScatterGl) {
757-
// loop over all subplots (w/o exceptions) here,
758-
// as we cleared the gl canvases above
759752
for(i = 0; i < subplots.length; i++) {
760753
sp = plotinfos[subplots[i]];
761754
xa = sp.xaxis;
762755
ya = sp.yaxis;
763756

764-
var scene = sp._scene;
765-
if(scene) {
766-
// FIXME: possibly we could update axis internal _r and _rl here
757+
if(sp._scene) {
767758
var xrng = Lib.simpleMap(xa.range, xa.r2l);
768759
var yrng = Lib.simpleMap(ya.range, ya.r2l);
769-
scene.update({range: [xrng[0], yrng[0], xrng[1], yrng[1]]});
760+
sp._scene.update({range: [xrng[0], yrng[0], xrng[1], yrng[1]]});
770761
}
771762
}
772763
}
773764

765+
if(hasSplom || hasScatterGl) {
766+
clearGlCanvases(gd);
767+
redrawReglTraces(gd);
768+
}
769+
774770
if(hasSVG) {
775771
var xScaleFactor = viewBox[2] / xa0._length;
776772
var yScaleFactor = viewBox[3] / ya0._length;

src/traces/scattergl/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,6 @@ function sceneUpdate(gd, subplot) {
252252
scene.glText[i].update(opt);
253253
}
254254
}
255-
256-
scene.draw();
257255
};
258256

259257
// draw traces in proper order

src/traces/splom/base_plot.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function drag(gd) {
3939
var fullLayout = gd._fullLayout;
4040

4141
if(fullLayout._hasOnlyLargeSploms) {
42-
drawGrid(gd);
42+
updateGrid(gd);
4343
}
4444

4545
for(var i = 0; i < cd.length; i++) {
@@ -77,10 +77,8 @@ function dragOne(gd, trace, scene) {
7777

7878
if(scene.selectBatch) {
7979
scene.matrix.update({ranges: ranges}, {ranges: ranges});
80-
scene.matrix.draw(scene.unselectBatch, scene.selectBatch);
8180
} else {
8281
scene.matrix.update({ranges: ranges});
83-
scene.matrix.draw();
8482
}
8583
}
8684

0 commit comments

Comments
 (0)