-
Notifications
You must be signed in to change notification settings - Fork 94
Handling events
The ready
event is an event that occurs after panoViewer is initialized and all the drawing is ready.
This means that the WebGL texture binding process is finished after the image loads successfully. This is the most time-consuming part of the process, so it's a good idea to show the loading status. If the loading status is displayed, you can turn off the loading status after receiving the ready
event.
// Show loading status when creating panoViewer
// It occurs when the preparation for drawing is completed.
panoViewer.on("ready", function() {
// After receiving the ready event, set the loading state to off
});
The viewChange event is an event that occurs when the orientation (yaw / pitch) or view angle (fov) changes.
At this point, it's a good time to figure out what direction you're currently viewing. If you check the yaw value, you can judge how many degrees it is based on the current left and right direction.
viwer.on({
"viewChange" : function(evt) {
//Use evt.yaw value to update the direction you are looking at.
}
});
Animation is performed when a user causes inertial movement through a strong gesture, or when the user requests the lookAt () method to move the screen for a period of time. The event that occurs at the end of this animation is animationEnd.
viwer.on({
"animationEnd" : function() {
// animation ended
}
});
If you need to resize the viewer, you should call updateViewportDimensions ()
.
panoViewer.updateViewportDimensions({width: 300, height: 200});