Skip to content

gl2d data-referenced annotations #1301

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 14 commits into from
Jan 19, 2017
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
replace scene2d.updateFx with scene2d.updateRefs
- scene2d.updateRefs is now called on scene2d.plot
  and during Plots.supplyDefaults, ensuring that
  scene2d.fullLayout is up-to-date with gd._fullLayout.
  • Loading branch information
etpinard committed Jan 17, 2017
commit ce1cc44e905a8e467c404906247e2ec063d66daa
7 changes: 2 additions & 5 deletions src/plot_api/subroutines.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,8 @@ exports.doModeBar = function(gd) {
scene.updateFx(fullLayout.dragmode, fullLayout.hovermode);
}

subplotIds = Plots.getSubplotIds(fullLayout, 'gl2d');
for(i = 0; i < subplotIds.length; i++) {
var scene2d = fullLayout._plots[subplotIds[i]]._scene2d;
scene2d.updateFx(fullLayout);
}
// no need to do this for gl2d subplots,
// Plots.linkSubplots takes care of it all.

subplotIds = Plots.getSubplotIds(fullLayout, 'geo');
for(i = 0; i < subplotIds.length; i++) {
Expand Down
23 changes: 7 additions & 16 deletions src/plots/gl2d/scene2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ function Scene2D(options, fullLayout) {
this.id = options.id;
this.staticPlot = !!options.staticPlot;

this.fullLayout = fullLayout;
this.fullData = null;
this.updateAxes(fullLayout);
this.updateRefs(fullLayout);

this.makeFramework();

Expand Down Expand Up @@ -278,22 +277,15 @@ function compareTicks(a, b) {
return false;
}

proto.updateAxes = function(options) {
proto.updateRefs = function(newFullLayout) {
this.fullLayout = newFullLayout;

var spmatch = Axes.subplotMatch,
xaxisName = 'xaxis' + this.id.match(spmatch)[1],
yaxisName = 'yaxis' + this.id.match(spmatch)[2];

this.xaxis = options[xaxisName];
this.yaxis = options[yaxisName];
};

proto.updateFx = function(options) {
var fullLayout = this.fullLayout;

fullLayout.dragmode = options.dragmode;
fullLayout.hovermode = options.hovermode;

this.graphDiv._fullLayout = fullLayout;
this.xaxis = this.fullLayout[xaxisName];
this.yaxis = this.fullLayout[yaxisName];
};

function relayoutCallback(scene) {
Expand Down Expand Up @@ -374,8 +366,7 @@ proto.destroy = function() {
proto.plot = function(fullData, calcData, fullLayout) {
var glplot = this.glplot;

this.fullLayout = fullLayout;
this.updateAxes(fullLayout);
this.updateRefs(fullLayout);
this.updateTraces(fullData, calcData);

var width = fullLayout.width,
Expand Down
4 changes: 4 additions & 0 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLa

if(oldSubplot) {
plotinfo = newSubplots[id] = oldSubplot;

if(plotinfo._scene2d) {
plotinfo._scene2d.updateRefs(newFullLayout);
}
}
else {
plotinfo = newSubplots[id] = {};
Expand Down