onViewChange

The callback function passed here is called whenever the view is changed by the user within the sphere view. User-changed views happen when the user adjusts pan or tilt with their mouse, or when they zoom in or out.

Parameter:

  • callback (function): A callback function to execute. It will be passed an object with the following properties:

    • azimuthAngle (number): The pan after the view change

    • polarAngle (number): The tilt after the view change

    • eventName (string): The name of the view change event. The possibilities are:

      • "controlstart": When the user starts to control the camera via mouse / touches

      • "control": When the user controls the camera (dragging)

      • "controlend": When the user ends to control the camera

      • "update": When the camera position is updated

      • "wake": When the camera start moving

      • "sleep": When the camera end moving

    • zoom (number): The new zoom level after the view change. See sendData for how to set the zoom programmatically, and getData for reading the current zoom level outside of events.

Returns: Nothing

Code Sample