yskang

threejs-viewer-21

May 2nd, 2021 (edited)
606
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // 修改 PropertyPanel.js
  2. init() {
  3.   // ... other code snippet
  4.   const closeButton = document.createElement('div');    
  5.   closeButton.classList.add('property-panel-close-button');
  6.   container.appendChild(closeButton);
  7.   closeButton.addEventListener('click', e => {
  8.     e.preventDefault();
  9.     this.setVisible(false);
  10.   });
  11.   this.closeButton = closeButton;
  12.  
  13.   // ... other code snippet
  14.   this.setVisible(false);
  15. }
  16. // ... other code snippet
  17. setVisible(isVisible) {
  18.   if (isVisible) {
  19.     this.container.style.display = 'block';
  20.   } else {
  21.     this.container.style.display = 'none';
  22.   }
  23. }
  24.  
  25. isVisible() {
  26.   return this.container.style.display === 'block';
  27. }
  28.  
  29. // 修改 Viewer.js
  30. onMouseClicked( event ) {
  31.  
  32.     // ... other code snippets
  33.  
  34.     if(!this.propertyPanel.isVisible()) {
  35.       this.propertyPanel.setVisible(true);
  36.     }
  37. }
  38.  
RAW Paste Data