Skip to content

Commit 4631567

Browse files
committed
#30a adding graphDiv to Scene2d similarly to Scene / thanks @etpinard
1 parent 7dffbb6 commit 4631567

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/plots/gl2d/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ exports.plot = function plotGl2d(gd) {
5050
// If Scene is not instantiated, create one!
5151
if(scene === undefined) {
5252
scene = new Scene2D({
53-
container: gd.querySelector('.gl-container'),
5453
id: subplotId,
54+
graphDiv: gd,
55+
container: gd.querySelector('.gl-container'),
5556
staticPlot: gd._context.staticPlot,
5657
plotGlPixelRatio: gd._context.plotGlPixelRatio
5758
},

src/plots/gl2d/scene2d.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var STATIC_CANVAS, STATIC_CONTEXT;
2727

2828
function Scene2D(options, fullLayout) {
2929
this.container = options.container;
30+
this.graphDiv = options.graphDiv;
3031
this.pixelRatio = options.plotGlPixelRatio || window.devicePixelRatio;
3132
this.id = options.id;
3233
this.staticPlot = !!options.staticPlot;
@@ -275,7 +276,7 @@ var relayoutCallback = function(scene) {
275276
xrange: scene.xaxis.range.slice(0),
276277
yrange: scene.yaxis.range.slice(0)
277278
};
278-
scene.container.parentElement.parentElement.parentElement.emit('plotly_relayout', update);
279+
scene.graphDiv.emit('plotly_relayout', update);
279280
};
280281

281282
proto.cameraChanged = function() {

0 commit comments

Comments
 (0)