Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions src/traces/scattergl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,27 @@ function sceneUpdate(gd, subplot) {

// remove scene resources
scene.destroy = function destroy() {
if(scene.fill2d) scene.fill2d.destroy();
if(scene.scatter2d) scene.scatter2d.destroy();
if(scene.error2d) scene.error2d.destroy();
if(scene.line2d) scene.line2d.destroy();
if(scene.select2d) scene.select2d.destroy();
if((scene.fill2d) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking comment: We (me and @alexcjohnson ) would usually write these lines as

if(scene.fill2d && scene.fill2d.destroy) {
    scene.fill2d.destroy();
}

(scene.fill2d.destroy)) {
scene.fill2d.destroy();}
if((scene.scatter2d) &&
(scene.scatter2d.destroy)) {
scene.scatter2d.destroy();}
if((scene.error2d) &&
(scene.error2d.destroy)) {
scene.error2d.destroy();}
if((scene.line2d) &&
(scene.line2d.destroy)) {
scene.line2d.destroy();}
if((scene.select2d) &&
(scene.select2d.destroy)) {
scene.select2d.destroy();}
if(scene.glText) {
scene.glText.forEach(function(text) { text.destroy(); });
scene.glText.forEach(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this thing as

scene.glText.forEach(function(text) {
    if(text.destroy) text.destroy();
});

function(text) {
if(text.destroy) text.destroy();
}
);
}

scene.lineOptions = null;
Expand Down