Autodesk forge 关闭停靠面板时添加回调函数

Autodesk forge 关闭停靠面板时添加回调函数,autodesk-forge,Autodesk Forge,我试图在用户通过单击十字关闭停靠面板时添加回调函数: 我已经阅读了文档,但是我不知道怎么做。我已经找到了如何关闭我的停靠面板,但在右角的十字架上单击关闭事件时没有任何内容 我该怎么做呢?这很简单,您只需添加几行即可存档: dockpanel.addVisibilityListener(function( show ) { if( show ) { // Logic for opening the panel } else { // Logic for closin

我试图在用户通过单击十字关闭停靠面板时添加回调函数:

我已经阅读了文档,但是我不知道怎么做。我已经找到了如何关闭我的停靠面板,但在右角的十字架上单击关闭事件时没有任何内容


我该怎么做呢?

这很简单,您只需添加几行即可存档:

dockpanel.addVisibilityListener(function( show ) {
   if( show ) {
     // Logic for opening the panel
   } else {
     // Logic for closing the panel
   }
});

参考资料:

另一种方法:

initDock = () => {
   // open the panel
   this.dock = new Autodesk.Viewing.UI.DockingPanel(
      this.viewer.container,
      'dock_panel',
      'Room Properties',
    )

    this.dock.closer.onclick = () => {
      //
      // this can be your call back on close stuff
      //
      this.buttonAddBox.setState(false)
      this.buttonAddBox.removeClass('button-add-box__active')
      this.dock.uninitialize()
    }

    this.dock.setVisible(true)
}