How to remove First person tool button from the Forge Navigation Tool bar

自作多情 提交于 2020-01-06 11:47:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!