Skip to content

Commit 6a271ed

Browse files
committed
call setConvert on 3d axis during Scene.plot
- instead of pre-initialization - the pattern is more similar to other subplots (e.g. ternary) and requires one less module
1 parent 2289657 commit 6a271ed

File tree

3 files changed

+9
-39
lines changed

3 files changed

+9
-39
lines changed

src/plots/gl3d/index.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ var Plots = require('../plots');
1414
var Lib = require('../../lib');
1515
var xmlnsNamespaces = require('../../constants/xmlns_namespaces');
1616

17-
var axesNames = ['xaxis', 'yaxis', 'zaxis'];
18-
19-
2017
exports.name = 'gl3d';
2118

2219
exports.attr = 'scene';
@@ -45,8 +42,6 @@ exports.plot = function plotGl3d(gd) {
4542
scene = sceneLayout._scene;
4643

4744
if(!scene) {
48-
initAxes(gd, sceneLayout);
49-
5045
scene = new Scene({
5146
id: sceneId,
5247
graphDiv: gd,
@@ -118,13 +113,3 @@ exports.cleanId = function cleanId(id) {
118113

119114
return 'scene' + sceneNum;
120115
};
121-
122-
exports.setConvert = require('./set_convert');
123-
124-
function initAxes(gd, sceneLayout) {
125-
for(var j = 0; j < 3; ++j) {
126-
var axisName = axesNames[j];
127-
128-
sceneLayout[axisName]._gd = gd;
129-
}
130-
}

src/plots/gl3d/scene.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ var showNoWebGlMsg = require('../../lib/show_no_webgl_msg');
2222

2323
var createCamera = require('./camera');
2424
var project = require('./project');
25-
var setConvert = require('./set_convert');
2625
var createAxesOptions = require('./layout/convert');
2726
var createSpikeOptions = require('./layout/spikes');
2827
var computeTickMarks = require('./layout/tick_marks');
@@ -339,6 +338,7 @@ proto.plot = function(sceneData, fullLayout, layout) {
339338
this.glplot.snapToData = true;
340339

341340
// Update layout
341+
this.fullLayout = fullLayout;
342342
this.fullSceneLayout = fullSceneLayout;
343343

344344
this.glplotLayout = fullSceneLayout;
@@ -353,10 +353,7 @@ proto.plot = function(sceneData, fullLayout, layout) {
353353
this.glplot.update({});
354354

355355
// Update axes functions BEFORE updating traces
356-
for(i = 0; i < 3; ++i) {
357-
axis = fullSceneLayout[axisProperties[i]];
358-
setConvert(axis);
359-
}
356+
this.setConvert(axis);
360357

361358
// Convert scene data
362359
if(!sceneData) sceneData = [];
@@ -708,4 +705,11 @@ proto.toImage = function(format) {
708705
return dataURL;
709706
};
710707

708+
proto.setConvert = function() {
709+
for(var i = 0; i < 3; ++i) {
710+
var ax = this.fullSceneLayout[axisProperties[i]];
711+
Axes.setConvert(ax, this.fullLayout);
712+
}
713+
};
714+
711715
module.exports = Scene;

src/plots/gl3d/set_convert.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)