Constructor for the API: new IGuideViewer(iframeElement)
Methods:
ready()
- Returns a Promise that resolves when the iGUIDE is ready to be used.tour.move(position, camera, transitionType)
- Transition to a different pano.tour.moveCamera(camera)
- Change the user's camera.addEventListener(event, cb)
- Subscribe to an event.removeEventListener(event, cb)
- Unsubscribe from an event. Thecb
must be the same reference to a function passed earlier toaddEventListener()
.
Events:
ready
- This event fires when the iGUIDE is ready to be used.tour:move-start
, args(position, camera, transitionType)
- This event fires as soon as the user clicks to switch to a new pano or floor, before the transition begins. The arguments can be passed totour.move()
in the same order.tour:camera-move-start
args(camera)
- This event fires when the user begins rotating the pano. The arguments can be passed totour.moveCamera()
in the same order.tour:camera-move
args(camera)
- This event fires while the user is rotating the pano. The arguments can be passed totour.moveCamera()
in the same order.tour:camera-move-end
, args(camera)
- This event fires when the user finishes rotating the pano (and inertia has stopped rotating the pano, if applicable). The arguments can be passed totour.moveCamera()
in the same order.
Usage example:
const master = new IGuideViewer(document.getElementById('master-iframe'));
const slave = new IGuideViewer(document.getElementById('slave-iframe'));
await Promise.all(master.ready(), slave.ready());
master.addEventListener('tour:move-start', (position, camera, transitionType) => {
slave.tour.move(position, camera, transitionType);
});
master.addEventListener('tour:camera-move-end', camera => {
slave.tour.moveCamera(camera);
});