Well, before any of that happens I say you need a way in which you can correlate “zooming” inside an image with “zooming” inside 3D space.
From what you are saying, by “zooming” you mean varying the camera’s fov. That’s currently not being handled by any of our camera controllers. So setting zoom: true will not give you access to varying the camera’s fov. That option is restricted to the orbit controls (which you are not using)
The orbit controls does allow for purely setting the fov and also clamping it between the given min and max. If that’s all you need this functionality can be easily translated to the fly controls.
I’ll show you a live example as soon as I get the chance to make it
Got it, I was still unable to trigger the zoom in and zoom out ability in speckle viewer with waypoint navigation mode…
By zoom in and zoom out I meant, the ability to scroll and zoom to change the fov…
I commented out the line at 52, I was using it to set the default fov on initial load.
I’m not able to use the “pinch to zoom” or “scroll” to change my fov, that’s what I meant, I even have the enableZoom turned on so that the behaviour takes place..
There is a misconception here. enableZoomdoes not allow you to change the camera fov on mouse wheel or pinch zoom. It’s an option that targets the orbit controls and the “zoom” is the camera moving towards it’s target in 3d space, as you would naturally have it.
Like I said before, you already have the means to change the camera fov via the controller’s fieldOfView. This means that you can listen to input events in your application and act on the fov accordingly. Something along the lines of
viewer.getContainer().addEventListener('wheel', (event: WheelEvent) => {
camerControls.fileOfView += event.deltaY // Or whatever step you define
})
The viewer-library is a library. The idea behind it, is not to cover all the possible use cases that can exist, but rather to give users the means to develop applications that can span across as many uses cases as possible.
Yours is a very cool use case with the 360 image in sync with a 3D view. The default camera functionality that the viewer-library ships with, was not originally intended to be used as such, however it can be more or less configured to behave the way you need it to. For basic navigation it may be enough, but if you want to further develop the idea with more complex features, you can also look into implementing your own WaypointControls which can extend the stock FlyControls. Approaching it this way, you’ll have a better, reusable and modular implementation
I tried to add a listener for onWheel, and here’s what I found. Changing the fov using cameraControls.fieldOfView was causing nothing, but if I did it while panning, it would show me the change.
In the video it didn’t show my console logs, but if you scroll using mousewheel, it shows that the field of view is changing, but on screen nothing happens.
If you tried to pan and use mouse acceleration ( smoothing out animation of the panning ) , and during that time if you scrolled, it would show on screen also that the fov is changing.
Here is an updated example that works as you expect it to.
You were not telling the viewer to re-render by calling requestRender.
For your “waypoint” controller nothing else was needed. However I’ve also added two extra lines for the orbit controller, which you don’t use nor need but I’ve added them nonetheless for consistency.