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

Skip to content

Commit 888ee1b

Browse files
committed
Remove scene3d camera listeners
1 parent 234801d commit 888ee1b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/plots/gl3d/camera.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function createCamera(element, options) {
181181
});
182182

183183
var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false};
184-
mouseChange(element, handleInteraction);
184+
camera.mouseListener = mouseChange(element, handleInteraction);
185185

186186
// enable simple touch interactions
187187
element.addEventListener('touchstart', function(ev) {
@@ -247,7 +247,7 @@ function createCamera(element, options) {
247247
return true;
248248
}
249249

250-
mouseWheel(element, function(dx, dy) {
250+
camera.wheelListener = mouseWheel(element, function(dx, dy) {
251251
if(camera.keyBindingMode === false) return;
252252

253253
var flipX = camera.flipX ? 1 : -1;

src/plots/gl3d/scene.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,11 @@ proto.plot = function(sceneData, fullLayout, layout) {
593593
};
594594

595595
proto.destroy = function() {
596+
this.camera.mouseListener.enabled = false;
597+
this.container.removeEventListener('wheel', this.camera.wheelListener);
598+
this.camera = this.glplot.camera = null;
596599
this.glplot.dispose();
597600
this.container.parentNode.removeChild(this.container);
598-
599-
// Remove reference to glplot
600601
this.glplot = null;
601602
};
602603

0 commit comments

Comments
 (0)