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

Skip to content

Commit 6a67366

Browse files
committed
move 3d axes init step from makePlotFrameork -> Gl3d.plot
1 parent d31006d commit 6a67366

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

src/plot_api/plot_api.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2570,9 +2570,6 @@ function makePlotFramework(gd) {
25702570
var gd3 = d3.select(gd),
25712571
fullLayout = gd._fullLayout;
25722572

2573-
// TODO - find a better place for 3D to initialize axes
2574-
if(fullLayout._hasGL3D) Plots.subplotsRegistry.gl3d.initAxes(gd);
2575-
25762573
// Plot container
25772574
fullLayout._container = gd3.selectAll('.plot-container').data([0]);
25782575
fullLayout._container.enter().insert('div', ':first-child')

src/plots/gl3d/index.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ exports.plot = function plotGl3d(gd) {
4646
for(var i = 0; i < sceneIds.length; i++) {
4747
var sceneId = sceneIds[i],
4848
fullSceneData = Plots.getSubplotData(fullData, 'gl3d', sceneId),
49-
scene = fullLayout[sceneId]._scene; // ref. to corresp. Scene instance
49+
sceneLayout = fullLayout[sceneId],
50+
scene = sceneLayout._scene;
5051

5152
// If Scene is not instantiated, create one!
5253
if(scene === undefined) {
54+
initAxes(gd, sceneLayout);
55+
5356
scene = new Scene({
5457
id: sceneId,
5558
graphDiv: gd,
@@ -60,10 +63,11 @@ exports.plot = function plotGl3d(gd) {
6063
fullLayout
6164
);
6265

63-
fullLayout[sceneId]._scene = scene; // set ref to Scene instance
66+
// set ref to Scene instance
67+
sceneLayout._scene = scene;
6468
}
6569

66-
scene.plot(fullSceneData, fullLayout, gd.layout); // takes care of business
70+
scene.plot(fullSceneData, fullLayout, gd.layout);
6771
}
6872
};
6973

@@ -91,18 +95,10 @@ exports.cleanId = function cleanId(id) {
9195

9296
exports.setConvert = require('./set_convert');
9397

94-
exports.initAxes = function(gd) {
95-
var fullLayout = gd._fullLayout;
96-
var sceneIds = Plots.getSubplotIds(fullLayout, 'gl3d');
97-
98-
for(var i = 0; i < sceneIds.length; ++i) {
99-
var sceneId = sceneIds[i];
100-
var sceneLayout = fullLayout[sceneId];
98+
function initAxes(gd, sceneLayout) {
99+
for(var j = 0; j < 3; ++j) {
100+
var axisName = axesNames[j];
101101

102-
for(var j = 0; j < 3; ++j) {
103-
var axisName = axesNames[j];
104-
var ax = sceneLayout[axisName];
105-
ax._gd = gd;
106-
}
102+
sceneLayout[axisName]._gd = gd;
107103
}
108-
};
104+
}

0 commit comments

Comments
 (0)