Search code examples
autodesk-forgeautodesk-viewer

Set the panning state of the forge viewer manually


I have a case where I need to turn the panning state of the forge viewer on and off manually from a button custom button created outside the viewer. (Basically I need to recreate the functionality of the pan button within the forge viewer). Is this possible?


Solution

  • the navigation state can be switched by the code below:

    //get current mode
    myviewer.getActiveNavigationTool()
    //switch to pan
    myviewer.setActiveNavigationTool('pan')
    

    you could simply create your button and trigger the method setActiveNavigationTool when the button is clicked. The choices are: "orbit", "freeorbit", "dolly", "pan","firstperson" etc.