EventListener detect if model was orbited

Hi All,

Is there any scene.addEventListener that detects when the ShapeDiver canvas is orbited?

I have a CSS animation inviting users to “orbit” the canvas, as an advise that what they are seeing is a 3D model, so I want to detect when the user rotates the viewer and then hide the container with the CSS animation.

Thanks!

I haven’t tried the API yet but this page looks relevant?

https://viewer.shapediver.com/v2/2.18.0/doc/module-ApiSceneInterface-ApiSceneInterface.html#EVENTTYPE

Specifically, these three event types:

DRAG_START SceneEventType drag.start dragging of an object started
DRAG_MOVE SceneEventType drag.move continuously fired during dragging of an object
DRAG_END SceneEventType drag.end dragging of an object ended

And maybe this page too?

Thank you @Joseph_Oster, I had previously tried with these SceneEventType and I think that they are waiting for an object to move from position (maybe for clickable 3d objects).

I also tried with HOVER_ON SceneEventType and it works when the mouse hovers an object (callback), but I want specifically fire an event when the scene is orbited.

Thanks!

That makes sense. Scrolling the page a little more I see this one:

LIVETRANSFORMATIONTYPE :LiveTransformationType

Enum for supported live transformation types.

Type:
Properties:
Name Type Default Description
ROTATION LiveTransformationType rotation the transformation is a rotation

But again, I could be wrong. I better hold off until I try these things myself.

There are general camera movement events that are triggered when any camera movement starts, is in progress or stops: http://app.shapediver.com/api/module-CameraApi-CameraApi.html#EVENTTYPE

However, you won’t be able to discrimnate between the different types of movement (rotations, zooming and panning).

1 Like

Thank you @mathieu1 It works.

For the viewer I have zooming and panning disabled, so EVENTYPE CAMERA_START will detect rotation.

Thanks!