问题
There are some tool button avalible in navigation toolbar Forge viewer. So I want hide only "zoom tool" button and "first person tool" button from the tool bar.
I am able to remove zoom tool button from the tool bar using below code :
var navTool = this.viewer.toolbar.getControl('navTools'); navTool.removeControl('toolbar-zoomTool');
But I am not able to remove "First Person" tool button from the navigation tool bar.
Can anyone help me on this problem?
回答1:
Here is a more accurate answer on how to remove that specific control:
const onExtensionLoaded = (e) => {
if (e.extensionId === 'Autodesk.FirstPerson') {
const navTools = viewer.toolbar.getControl('navTools')
navTools.removeControl('toolbar-firstPersonTool')
viewer.removeEventListener(
Autodesk.Viewing.EXTENSION_LOADED_EVENT,
onExtensionLoaded)
}
}
viewer.addEventListener(
Autodesk.Viewing.EXTENSION_LOADED_EVENT,
onExtensionLoaded)
viewer.start()
来源:https://stackoverflow.com/questions/49334001/how-to-remove-first-person-tool-button-from-the-forge-navigation-tool-bar