Prevent innerHTML from reloading when returning to scene


(Isaac Brown) #1

Hi all!,
I’ll do my best to explain what my issue is here.

I am loading a 360 degree tour (Pano2VR) into a rectangle element’s innerHTML. This is working great! The only issue is when I leave the scene by clicking a button and going to the next scene, then return to the scene with the rectangle element my panorama tour appears black. The following code is run onSceneLoad .(the rectangle id is container) :

	pano = new pano2vrPlayer("container");
	window.addEventListener("load", function() {
		pano.readConfigUrlAsync("pano.xml", function() {
			gyro = new pano2vrGyro(pano, "container");
			gyro.disable();
		});
	});

I think perhaps it is trying to load a second panorama container or something?

Anyone have thoughts?


#2

You initialize the Pano on scene but the event-handler much likely will not be called again

Have you tried keeping the Pano-Player in a persistant symbol?
Guestimating from my Phone on the run.


#3

Also guestimating, as you’re already running this code in an “event” listener (On Scene Load) why not just get rid of the window.onload listener and run it like

pano = new pano2vrPlayer("container");
pano.readConfigUrlAsync("pano.xml", function() {
	gyro = new pano2vrGyro(pano, "container");
	gyro.disable();
});

(Isaac Brown) #4

@DBear @MaxZieb both your replies make a lot of sense. I will implement these, test and return my outcome.

Thanks heaps for the quick replies.

Can always count on this forum! :slight_smile:


(Isaac Brown) #5

@DBear Your solution worked! Now that I understand it is such an obvious fix!
Thanks again.