8000 Add redrawReglTraces subroutine by etpinard · Pull Request #3067 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Add redrawReglTraces subroutine #3067

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

Merged
merged 7 commits into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use redrawReglTraces on drag
  • Loading branch information
etpinard committed Oct 2, 2018
commit dcacd7813660d46a3758b0118c52c6b09f1c4e10
26 changes: 11 additions & 15 deletions src/plots/cartesian/dragbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ var supportsPassive = require('has-passive-events');
var Registry = require('../../registry');
var Lib = require('../../lib');
var svgTextUtils = require('../../lib/svg_text_utils');
var clearGlCanvases = require('../../lib/clear_gl_canvases');
var Color = require('../../components/color');
var Drawing = require('../../components/drawing');
var Fx = require('../../components/fx');
var setCursor = require('../../lib/setcursor');
var dragElement = require('../../components/dragelement');
var FROM_TL = require('../../constants/alignment').FROM_TL;
var clearGlCanvases = require('../../lib/clear_gl_canvases');
var redrawReglTraces = require('../../plot_api/subroutines').redrawReglTraces;

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

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

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

var fullLayout = gd._fullLayout;
hasScatterGl = fullLayout._has('scattergl');
hasOnlyLargeSploms = fullLayout._hasOnlyLargeSploms;
hasSplom = hasOnlyLargeSploms || fullLayout._has('splom');
hasSplom = fullLayout._has('splom');
hasSVG = fullLayout._has('svg');
}

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

if(hasSplom || hasScatterGl) {
clearGlCanvases(gd);
}

if(hasSplom) {
Registry.subplotsRegistry.splom.drag(gd);
if(hasOnlyLargeSploms) return;
}

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

var scene = sp._scene;
if(scene) {
// FIXME: possibly we could update axis internal _r and _rl here
if(sp._scene) {
var xrng = Lib.simpleMap(xa.range, xa.r2l);
var yrng = Lib.simpleMap(ya.range, ya.r2l);
scene.update({range: [xrng[0], yrng[0], xrng[1], yrng[1]]});
sp._scene.update({range: [xrng[0], yrng[0], xrng[1], yrng[1]]});
}
}
}

if(hasSplom || hasScatterGl) {
clearGlCanvases(gd);
redrawReglTraces(gd);
}

if(hasSVG) {
var xScaleFactor = viewBox[2] / xa0._length;
var yScaleFactor = viewBox[3] / ya0._length;
Expand Down
2 changes: 0 additions & 2 deletions src/traces/scattergl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ function sceneUpdate(gd, subplot) {
scene.glText[i].update(opt);
}
}

scene.draw();
};

// draw traces in proper order
Expand Down
4 changes: 1 addition & 3 deletions src/traces/splom/base_plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function drag(gd) {
var fullLayout = gd._fullLayout;

if(fullLayout._hasOnlyLargeSploms) {
drawGrid(gd);
updateGrid(gd);
}

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

if(scene.selectBatch) {
scene.matrix.update({ranges: ranges}, {ranges: ranges});
scene.matrix.draw(scene.unselectBatch, scene.selectBatch);
} else {
scene.matrix.update({ranges: ranges});
scene.matrix.draw();
}
}

Expand Down
0