[英]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 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 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它触发了engageEditMode 函数,将值false 传递给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;我可以在我的 HTML 上看到工具栏,但所有节点都带有显示; 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.我只是仔细检查了行为,你是对的 - 简单地调用
markupsCore.leaveEditMode
不会带回工具栏。 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:为了重新启用工具栏,您还必须“隐藏”标记叠加层,因此您的
engageEditMode
函数应如下所示:
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();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.