Skip to content

Commit 84fb9fa

Browse files
committed
clear old gl2d in cleanPlot step
1 parent 0b120f9 commit 84fb9fa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/plots/gl2d/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,17 @@ exports.plot = function plotGl2d(gd) {
6565
scene.plot(fullSubplotData, fullLayout, gd.layout);
6666
}
6767
};
68+
69+
exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {
70+
var oldSceneKeys = Plots.getSubplotIds(oldFullLayout, 'gl2d');
71+
72+
for(var i = 0; i < oldSceneKeys.length; i++) {
73+
var oldSubplot = oldFullLayout._plots[oldSceneKeys[i]],
74+
xaName = oldSubplot.xaxis._name,
75+
yaName = oldSubplot.yaxis._name;
76+
77+
if(!!oldSubplot._scene2d && (!newFullLayout[xaName] || !newFullLayout[yaName])) {
78+
oldSubplot._scene2d.destroy();
79+
}
80+
}
81+
};

0 commit comments

Comments
 (0)