Updating the viewer settings keeps zooming to the extents of the scene

Hey,

I am really confused right now and do not really understand what’s happening.

I am trying to dynamically update the settings of the viewer (to restrict user controls depending on the situation). However, everytime I update the settings, the camera zooms to the extents of the scene! See the following gif

The basicViewerSettings are defined as:

  basicViewerSettings = {
    blurSceneWhenBusy: true,
    ignoreSuperseded: true,   // 	Ignore intermediate solutions which at the time of their arrival have already been superseded by another customization request
    loggingLevel: 1, 
    scene: {
      gridVisibility: false,
      groundPlaneVisibility: true,
      groundPlaneReflectionVisibility: false,
      camera: {
        autoAdjust: false, //camera should not auto adjust to geometry updates, we will implement a more detailed version of this ourselves
        revertAtMouseUp: false, // Enable / disable if the camera should be reset to its default position and target on mouse up
        zoomExtentsFactor:1.2, //Factor to apply to the bounding box before zooming to extents
        controls:{
        orbit:{
            enablePan: true, //enable panning/right click movements
            enableKeyPan: false, //disable panning with keyboard
            panSpeed: 1.0, //speed of rightclick movement
            enableRotation: true, //enable rotations/left click movements
            enableAutoRotation: false, //enable / disable automatic rotation of the camera
            rotationSpeed: 1.0,
            enableZoom: true,
            zoomSpeed: 1.5,	 //Speed of zooming
            //damping: 	Number 	How much to damp camera movements by the user
            restrictions: {
              rotation: {
                minPolarAngle: 0,
                maxPolarAngle: 90
              }
            }
          }
        }
      }
    }
  }

Thanks for any help!
David

I coud reproduce the problem. We are working on the issue and will get back to you when a fix is released.

In the meantime, you can try to use the updateSettingAsync() function that allows you to update one setting at a time. This function does not seem to trigger the unwanted zoom. But of course if you need to update many settings at the same time, this is not ideal.

@DAUD

I identified the issue more precisely: the zooming is triggered because your settings object updates the zoomExtentsFactor setting. Updating this setting will always zoom to the extents of the scene using the new value of the factor.

Now my question is: do you really need to update this setting dynamically, or could you do it once at the beginning? And if you do need to change the value of this setting during the configuration process, could you update it a the same time that the zoom extents needs to be triggered?

@mathieu1

Thank you, thank you, thank you! This had taken quiet a toll on me :wink: Everything works perfectly now.
I had been looking for specific settings that might update the camera but did not think of this one.

Best
David

1 Like