简体   繁体   中英

Forge Viewer toolbar not display after leave edit mode

I'm using the code from this example as a guide:

https://forge-rcdb.autodesk.io/configurator?id=598d7ec14cabf2c1f4dec948

Sourcecode is available here but apparently code is different from the example:

https://github.com/Autodesk-Forge/forge-rcdb.nodejs/tree/89e2e0af1d87e3b948cb66bc88f54140c6e8a0e8/src/client/components/Viewer/Extensions/Dynamic/Viewing.Extension.Markup2D

When I close the panel clicking on the button "Close" I'd like to display the toolbar and leave the edit mode / view mode, but I'm missing something. That's how I'm doing it:

        on('click', '[data-panel-action="finish"]', function (event) {
            event.preventDefault();
            // hide the panel when click button Close
            self.setVisible(false);
        })

It triggers the engageEditMode function passing the value false to enabled

        panelProto.engageEditMode = function (enabled) {
        var markupsCore = this.markupsCore
        if (enabled) {
            markupsCore.enterEditMode();
            this.selectDefaultAnnotation();
        } else {
            //Should display the toolbar here but I don't know how.
            markupsCore.leaveEditMode();
        }
    }

I can see the toolbar on my HTML, but all the nodes are with display; none, my last resource would be get them and change the style to display; block or something, but I know that the viewer has something that trigger the toolbar to load again.

I just double-checked the behavior, and you are correct - simply calling markupsCore.leaveEditMode doesn't bring back the toolbar. In order for the toolbar to be re-enabled, you also have to "hide" the markup overlay, so your engageEditMode function should look like this:

panelProto.engageEditMode = function (enabled) {
    const markupsCore = this.markupsCore;
    if (enabled) {
        markupsCore.enterEditMode();
        this.selectDefaultAnnotation();
    } else {
        // Should display the toolbar here but I don't know how.
        markupsCore.leaveEditMode();
        markupsCore.hide();
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM