yskang

adsk-forge-LevelSectionPanel-step11

Apr 29th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. createUI() {
  2.     const viewer = this.viewer;
  3.     const lvlSectionPanel = new LevelSectionPanel( viewer, 'Level Section' );
  4.  
  5.     viewer.addPanel(lvlSectionPanel);
  6.     this.panel = lvlSectionPanel;
  7.  
  8.     const lvlSectionButton = new Autodesk.Viewing.UI.Button( 'toolbar-adnLevelSectionsTool' );
  9.     lvlSectionButton.setToolTip( 'Level Sections' );
  10.     lvlSectionButton.setIcon( 'adsk-icon-plane-y' );
  11.     lvlSectionButton.onClick = () => {
  12.         lvlSectionPanel.setVisible(!lvlSectionPanel.isVisible());
  13.     };
  14.  
  15.     // ...
  16.     const subToolbar = new Autodesk.Viewing.UI.ControlGroup( 'toolbar-adn-tools' );
  17.     subToolbar.addControl( lvlSectionButton );
  18.     this.subToolbar = subToolbar;
  19.     viewer.toolbar.addControl( this.subToolbar );
  20.  
  21.     lvlSectionPanel.addVisibilityListener(( visible ) => {
  22.        if ( visible )
  23.            viewer.onPanelVisible( lvlSectionPanel, viewer );
  24.  
  25.        lvlSectionButton.setState( visible ? Autodesk.Viewing.UI.Button.State.ACTIVE : Autodesk.Viewing.UI.Button.State.INACTIVE );
  26.     });
  27. }
Advertisement
Add Comment
Please, Sign In to add comment