pixi-viewport icon indicating copy to clipboard operation
pixi-viewport copied to clipboard

Why I cannot destroy viewport on zoomed end event?

Open devexus opened this issue 2 years ago • 1 comments

I want to change the view when I reach the set scale. I try to remove the viewport from the Pixi children and then run the destroy method. I received an error.

image

devexus avatar Oct 02 '23 22:10 devexus

Simply because events are fired synchronously, and inside of viewport it has some other code to do after it fired zoom-end event. Destroy method does something like this.transform = null on display object, but viewport accesses position of the object, which is null, after it fired the event, and we have cannot get properties of null exception

blnvdanil avatar Oct 10 '23 10:10 blnvdanil