JS api current panorama

Q&A about the latest versions
Post Reply
nikonetoo
Posts: 4
Joined: Mon Aug 25, 2014 1:17 pm

how to use javascript to find the current panorama src ?
User avatar
JimWatters
Posts: 329
Joined: Thu Oct 07, 2010 6:16 pm
Location: Saint John, New Brunswick
Contact:

If you look at the code generated by enabling "Include Google Maps" and "Direct node access" on HTML5 Output | HTML
you should see what you need.
nikonetoo
Posts: 4
Joined: Mon Aug 25, 2014 1:17 pm

JimWatters wrote:If you look at the code generated by enabling "Include Google Maps" and "Direct node access" on HTML5 Output | HTML
you should see what you need.
all panoramas created in the swf. I want to get the current current swf, which is viewed by the user.
In js api described as a move to the desired panorama
pano.openNext(<url:String>,<parameter:String>); // Open next panorama
nikonetoo
Posts: 4
Joined: Mon Aug 25, 2014 1:17 pm

how do you know the current panorama, if the tour in html5
User avatar
JimWatters
Posts: 329
Joined: Thu Oct 07, 2010 6:16 pm
Location: Saint John, New Brunswick
Contact:

You need the pro version of Pano2VR and you need to enable direct node access in the HTML tab of Flash Output.

I used getCurrentNode to sync left and right view to the same node in a tour.

Code: Select all

		// syncronize both panoramas
		var lastPan,lastTilt,lastFov,lastLeft,lastRigth;
		lastLeft=pano_left.getCurrentNode();
		lastRight=pano_right.getCurrentNode();
		function syncPanos() {
			try {
			if(lastRight!==pano_right.getCurrentNode()){
				pano_left.openNext("{" + pano_right.getCurrentNode() + "}", "$cur");
			}
			else if(lastLeft!==pano_left.getCurrentNode()){
				pano_right.openNext("{" + pano_left.getCurrentNode() + "}", "$cur");
			}
			lastLeft=pano_left.getCurrentNode();
			lastRight=pano_right.getCurrentNode();
			var panoSrc=pano_left;
			var panoDst=pano_right;
			if ((lastPan!=pano_right.getPan()) ||
				(lastTilt!=pano_right.getTilt()) ||
				(lastFov!=pano_right.getFov())) {
					panoSrc=pano_right;
					panoDst=pano_left;
				}
				lastPan=panoSrc.getPan();
				lastTilt=panoSrc.getTilt();
				lastFov=panoSrc.getFov();
				panoDst.setPanTiltFov(lastPan,lastTilt,lastFov);
			} catch(e) {}
		}
		setInterval ( "syncPanos()", 10 );
		syncPanos();
Post Reply