瀏覽代碼

hide Export control when no structure is loaded

Yana Rose 4 年之前
父節點
當前提交
277caec0e0
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/viewer/ui/export.tsx

+ 7 - 0
src/viewer/ui/export.tsx

@@ -13,6 +13,13 @@ export class ExportControls extends CollapsableControls {
             brand: { accent:  'gray' as const, svg: ExportOutlinedSvg }
         };
     }
+
+    componentDidMount() {
+        this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, sel => {
+            this.setState({ isHidden: sel.structures.length === 0 });
+        });
+    }
+
     protected renderControls(): JSX.Element | null {
         return <div className={'msp-control-offset'} style={{ paddingTop: '1px' }}>
             <CoordinatesExportControls />