I'd like to remove some buttons from the Forge Toolbar.
So far I've used the code by @Philippe at PhilippeAnswer and I successfully removed all the buttons in the 'navTools' and 'modelTools'. When trying with the 'settingsTools' I can remove only the ModelBrowser button, not the Properties or Settings or Fullscreen button (in debug mode I see these controls as null values). Here is my code:
var viewerDiv = document.getElementById('MyViewerDiv');
viewer = new Autodesk.Viewing.Private.GuiViewer3D(viewerDiv);
const onExtensionLoaded = (e) => {
if (e.extensionId === 'Autodesk.DefaultTools.NavTools') {
const settingsTools = viewer.toolbar.getControl('settingsTools')
settingsTools.removeControl('toolbar-modelStructureTool') //That's ok!
settingsTools.removeControl('toolbar-propertiesTool') //NOT FUNCTIONING
const settingsButton = settingsTools.getControl('toolbar-propertiesTool') //It remains as null when debugging
settingsTools.removeControl(settingsButton)
settingsTools.removeControl('toolbar-settingsTool') //NOT FUNCTIONING
settingsTools.removeControl('toolbar-fullscreenTool') //NOT FUNCTIONING
viewer.removeEventListener(
Autodesk.Viewing.EXTENSION_LOADED_EVENT,
onExtensionLoaded)
}
}
viewer.addEventListener(Autodesk.Viewing.EXTENSION_LOADED_EVENT, onExtensionLoaded)
viewer.start(svfUrl, modelOptions, onLoadModelSuccess, onLoadModelError);
I know I can hide the entire settingsTool, but then I have the same problem when making visible to true for Property/Settings/Fullscreen button. It seems again the control remains null when debugging the code.
Please, can you help me facing with the 3 last buttons in the 'settingsTools' toolbar? Essentially, I'm trying to understand the global customization of the viewer, removing everything in the UI is not my purpose :)
Thanks!!