Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce1cc44

Browse files
committed
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.
1 parent ee6d7d8 commit ce1cc44

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

src/plot_api/subroutines.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,8 @@ exports.doModeBar = function(gd) {
303303
scene.updateFx(fullLayout.dragmode, fullLayout.hovermode);
304304
}
305305

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

312309
subplotIds = Plots.getSubplotIds(fullLayout, 'geo');
313310
for(i = 0; i < subplotIds.length; i++) {

src/plots/gl2d/scene2d.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ function Scene2D(options, fullLayout) {
3434
this.id = options.id;
3535
this.staticPlot = !!options.staticPlot;
3636

37-
this.fullLayout = fullLayout;
3837
this.fullData = null;
39-
this.updateAxes(fullLayout);
38+
this.updateRefs(fullLayout);
4039

4140
this.makeFramework();
4241

@@ -278,22 +277,15 @@ function compareTicks(a, b) {
278277
return false;
279278
}
280279

281-
proto.updateAxes = function(options) {
280+
proto.updateRefs = function(newFullLayout) {
281+
this.fullLayout = newFullLayout;
282+
282283
var spmatch = Axes.subplotMatch,
283284
xaxisName = 'xaxis' + this.id.match(spmatch)[1],
284285
yaxisName = 'yaxis' + this.id.match(spmatch)[2];
285286

286-
this.xaxis = options[xaxisName];
287-
this.yaxis = options[yaxisName];
288-
};
289-
290-
proto.updateFx = function(options) {
291-
var fullLayout = this.fullLayout;
292-
293-
fullLayout.dragmode = options.dragmode;
294-
fullLayout.hovermode = options.hovermode;
295-
296-
this.graphDiv._fullLayout = fullLayout;
287+
this.xaxis = this.fullLayout[xaxisName];
288+
this.yaxis = this.fullLayout[yaxisName];
297289
};
298290

299291
function relayoutCallback(scene) {
@@ -374,8 +366,7 @@ proto.destroy = function() {
374366
proto.plot = function(fullData, calcData, fullLayout) {
375367
var glplot = this.glplot;
376368

377-
this.fullLayout = fullLayout;
378-
this.updateAxes(fullLayout);
369+
this.updateRefs(fullLayout);
379370
this.updateTraces(fullData, calcData);
380371

381372
var width = fullLayout.width,

src/plots/plots.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,10 @@ plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLa
630630

631631
if(oldSubplot) {
632632
plotinfo = newSubplots[id] = oldSubplot;
633+
634+
if(plotinfo._scene2d) {
635+
plotinfo._scene2d.updateRefs(newFullLayout);
636+
}
633637
}
634638
else {
635639
plotinfo = newSubplots[id] = {};

0 commit comments

Comments
 (0)