Reputation: 35
The measure button of Autodesk Platform Services (forge viewer) does not work for me. When the toolbar is vertical and I click on the button, it does nothing. When it is horizontal there is no problem. The rest of the buttons work fine.
I would like to find a solution to be able to position the tool vertically with the measure button working.
I have also verified that it does not work horizontally when we add it to another toolbar
Upvotes: 1
Views: 91
Reputation: 2135
The Viewer does actually support vertical toolbars - see function ToolBar(id, options)
in viewer3D.js that has option alignVertically
, and if that's true, it simply adds class adsk-toolbar-vertical
to it.
One of the simplest ways to make the toolbar vertical is to create an extension that adds the same class to the toolbar once it has been created:
class VerticalToolbarExtension extends Autodesk.Viewing.Extension {
onToolbarCreated(toolbar) {
toolbar.addClass("adsk-toolbar-vertical");
}
}
Autodesk.Viewing.theExtensionManager.registerExtension('VerticalToolbarExtension', VerticalToolbarExtension);
let viewerDiv = document.getElementById('MyViewerDiv');
viewer = new Autodesk.Viewing.GuiViewer3D(viewerDiv,{extensions: ["VerticalToolbarExtension"]});
viewer.start();
viewer.loadDocumentNode(doc, viewables[0]);
I assume you are having issues because you are recreating the toolbar? In which case you would need to make sure that everything is as the Measure
tool expects it. You can check what it's trying to do when you click the Measure
button by looking at the MeasureExtension.prototype.enterMeasurementMode
function in Measure.js
Upvotes: 0