Prevent camera movement when selecting annotations

Hi,

I have a few annotations in 3d model and I want to restrict camera movement when it is selected. I read this forum topic Link

I implemented it using the following code

api.addEventListener('annotationSelect', function(index) {
          api.gotoAnnotation(index, {
            preventCameraAnimation: true,
            preventCameraMove: true
          });
        });

But the camera is still moving when I click the annotation.

Hi @saravananps I believe you’re mixing two things. The annotationSelect event listener is called whenever a user clicks or taps one of the annotation bubbles. Within that event handler you can then perform extra actions, such as changing a color or playing a sound. Here are two examples:


I don’t believe there’s any way you can influence the behavior of the native annotation click behavior.

The api.gotoAnnotation method is a method you can call yourself, with a menu or button for instance. When you do that, you have full control over the camera behavior as it is described in the docs. Here is an example:

You can see that the different buttons in that codepen have different camera behaviors. You can also see that clicking any of the annotations in the 3D model behaves exactly the same (the camera moves).

Hi @klaasnienhuis

Thanks for your detailed explanation. Sorry for my late reply.

I have gone through all of your CodePen samples. Thanks for providing it. I found that the following code in your sample does it.

// Avoid the camera movement when clicking an annotation
api.setAnnotationCameraTransition(false, true);

Thanks

2 Likes