farminf / pannellum-react

React Component for Pannellum (open source panorama viewer for the web)
MIT License
112 stars 81 forks source link

Potential fix to access denied error #84

Open mehdi-cit opened 3 years ago

mehdi-cit commented 3 years ago

Hello and thank you for this nice library! I had a similar issue as the one discussed in the issue: https://github.com/farminf/pannellum-react/issues/77 The very first time we use the <Pannellum image={some_URL_1} /> with the image source some_URL_1 it works fine. But whenever the I change the image property I pass to that same Pannellum instance exp: <Pannellum image={some_URL_2} />. I get the cannot access problem (all images are hosted on the same site & the problem only appear if I change the url I pass to the image property as I said). The problem disapears if I make a new instance Pannellum instance for every new image URL (But that's wasteful and causes flashing/re-loading ofthe whole panaroma)

I was able to "make it work" without always creating a new Pannellum instance for every new image URL. I had to comment out the line 211 in master/src/elements/Pannellum.js as seen below: if (state === "update") { // this.panorama.destroy(); }

I diagnoally read through the code (quickly, I might have missed something) and it seems the code simply removes canvas from container and the event listeners! I also checked memory consumption and it seems to be just fine

So my question is whether it's really safe to remove that this.panorama.destroy(); call ?

Thank you again!

bekatom commented 2 years ago

@mehdi-cit Did you find a solution? I have the same issue