Skip to content

Shapes not deleted when clearing all shapes #464

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

Closed
aaliddell opened this issue Apr 22, 2016 · 4 comments
Closed

Shapes not deleted when clearing all shapes #464

aaliddell opened this issue Apr 22, 2016 · 4 comments
Labels
bug something broken

Comments

@aaliddell
Copy link

aaliddell commented Apr 22, 2016

Hi,

I've come across an issue in the recent version whereby calling Plotly.relayout to remove all shapes (i.e shapes: []) does not remove the shape svg elements. Is there a check somewhere that is bailing out when shapes.length == 0, without first checking if there are elements to remove?

In this example, the red shape should be removed by the call to relayout with an empty shapes array: http://codepen.io/anon/pen/pyZPxX

In this example, using a non-empty shapes array in relayout results in the expected behavior (red removed, blue added): http://codepen.io/anon/pen/XdBRym

This worked in prior versions, so has there been a change in the advised method of removing all shapes? The current workaround I'm having to use is to add a tiny invisible shape when I want to remove all other shapes, which is a bit of a bodge.

Edit: As as addition: shapes that are present when calling Plotly.relayout with shapes: [] appear to be orphaned and never cleaned up in subsequent calls to relayout, even when the shapes array is non-empty. Meaning the chart ends up covered in old shapes.

@n-riesco
Copy link
Contributor

I can reproduce it in v1.9.0, but it isn't present in v1.8.0. I'm now bisecting the commits.

@n-riesco
Copy link
Contributor

And the guilty commit is ... f67ff4d

That's my bad. I will revert the commit, add a comment in the code, and test to prevent this from happening again.

@aaliddell
Copy link
Author

Excellent!

Do you have any vague estimate of when this would be in a release? Basically, is it worth applying your patch myself to a local copy, or will it be pushed in the next few days anyway?

@etpinard
Copy link
Contributor

Do you have any vague estimate of when this would be in a release

should be early next week.

etpinard added a commit that referenced this issue Apr 22, 2016
Fixes #464 (shapes not deleted when clearing all shapes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

3 participants