Search code examples
autodesk-forgeautodesk-viewer

Get zoom value when zoom is changed in Forge Viewer


I need to show some Sprites when the camera gets close to a building and when the camera zoom out, remove the Sprites.

Is there any event that triggered when zoom changes? Also, How can we get the current zoom value?


Solution

  • There is an event trigerred when Camera changes (included zoom) :

    viewer.addEventListener(Autodesk.Viewing.CAMERA_CHANGE_EVENT, (e) => {
        console.log(e)
    })
    

    There is a zoom property in the event received. You will additionally find a lot of informations