mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.

Home Page:https://pannellum.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading scenes in quick succession does not swap to the most recent scene

needsmorecoffee opened this issue · comments

I noticed if you call loadScene multiple times in quick succession, it seems to have to wait until the first scene is loaded before it will accept any subsequent load requests.

I tried to get around this by using .on('load') and loading/swapping the next scene there, but I get an error relating to setting the image src:

pannellum.js:674 ERROR TypeError: Cannot set properties of undefined (setting 'src')
    at FileReader.<anonymous> (src\assets\pannellum-latest\js\pannellum.js:642:1)

Is there any other way I can get around this without using setTimeout to add an arbritary delay between scene loads?

I just changed the order of where the panoImage object is cleared relative to the load event, so calling loadScene in a load event handler will probably work now (although I did not verify it).