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

Programmatically detach EasyPZ #13

Closed
stardisblue opened this issue Jun 10, 2020 · 3 comments · Fixed by #14
Closed

Programmatically detach EasyPZ #13

stardisblue opened this issue Jun 10, 2020 · 3 comments · Fixed by #14

Comments

@stardisblue
Copy link
Contributor

Hello

I ran accross this problem when I was using easypz, and wanted to reset the zoom with a button.
Since the option did not exist, I tried to destroy and recreate an new EasyPZ object new EasyPZ(samedom, ....), doing so N times creates an number of eventlisteners that I'm not able to remove (unless I recreate the DOM object and also loose whatever other eventlisteners were bound to it).

I did create a child class, ironically named DestroyableEasyPZ, but i think it should be doable to implement it in the original class.

https://observablehq.com/@stardisblue/hello-easypz

This could also serve other usecases where you want to enable/disable easypz while conserving the zoom and translate values.

@stardisblue
Copy link
Contributor Author

I can also pull request this feature if you agree :)

@michaschwab
Copy link
Owner

Hi @stardisblue , thanks for your request!
For your use case of resetting zoom, I think there are better solutions than destroying EasyPZ.

But independent from the application, I think being able to detach EasyPZ could be useful. I would probably accept a pull request for that!

Best,
Micha

@michaschwab
Copy link
Owner

Thanks! Will resolve it in the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants