Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dispose delaunayMeadh on scatter3d toggle [fixes #399] #405

Merged
merged 3 commits into from
Apr 7, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/traces/scatter3d/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,15 @@ proto.dispose = function() {
this.scatterPlot.dispose();
}
if(this.errorBars) {
this.scene.remove(this.errorBars);
this.scene.glplot.remove(this.errorBars);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mdtusz one more.

this.errorBars.dispose();
}
if(this.textMarkers) {
this.scene.glplot.remove(this.textMarkers);
this.textMarkers.dispose();
}
if(this.delaunayMesh) {
this.scene.glplot.remove(this.textMarkers);
this.scene.glplot.remove(this.delaunayMesh);
this.delaunayMesh.dispose();
}
};
Expand Down
28 changes: 27 additions & 1 deletion test/jasmine/tests/gl_plot_interact_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,17 @@ describe('Test gl plot interactions', function() {

beforeEach(function(done) {
gd = createGraphDiv();
Plotly.plot(gd, mock.data, mock.layout).then(function() {

var mockCopy = Lib.extendDeep({}, mock);

// lines, markers, text, error bars and surfaces each
// correspond to one glplot object
mockCopy.data[0].mode = 'lines+markers+text';
mockCopy.data[0].error_z = { value: 10 };
mockCopy.data[0].surfaceaxis = 2;
mockCopy.layout.showlegend = true;

Plotly.plot(gd, mockCopy.data, mockCopy.layout).then(function() {
delay(done);
});
});
Expand Down Expand Up @@ -190,6 +200,22 @@ describe('Test gl plot interactions', function() {
});
});

it('should be able to toggle visibility', function(done) {
var objects = gd._fullLayout.scene._scene.glplot.objects;

expect(objects.length).toEqual(5);

Plotly.restyle(gd, 'visible', 'legendonly').then(function() {
expect(objects.length).toEqual(0);

return Plotly.restyle(gd, 'visible', true);
}).then(function() {
expect(objects.length).toEqual(5);

done();
});
});

});

describe('gl2d plots', function() {
Expand Down