瀏覽代碼

Fixes #177 - Display name of JS file in inspector when a JS component is selected

Shaddock Heath 9 年之前
父節點
當前提交
579bed3bd5
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      Script/AtomicEditor/ui/frames/inspector/SelectionInspector.ts

+ 9 - 1
Script/AtomicEditor/ui/frames/inspector/SelectionInspector.ts

@@ -145,7 +145,7 @@ class JSComponentSection extends ComponentSection {
         this.hasDynamicAttr = true;
         this.hasDynamicAttr = true;
 
 
         this.subscribeToEvent(this, "AttributeEditResourceChanged", (ev) => this.handleAttributeEditResourceChanged(ev));
         this.subscribeToEvent(this, "AttributeEditResourceChanged", (ev) => this.handleAttributeEditResourceChanged(ev));
-
+        this.updateTitleFromComponentClass();
     }
     }
 
 
     private handleAttributeEditResourceChanged(ev: AttributeEditResourceChangedEvent) {
     private handleAttributeEditResourceChanged(ev: AttributeEditResourceChangedEvent) {
@@ -157,7 +157,15 @@ class JSComponentSection extends ComponentSection {
 
 
         var attrInfos = jsc.getAttributes();
         var attrInfos = jsc.getAttributes();
         this.updateDynamicAttrInfos(attrInfos);
         this.updateDynamicAttrInfos(attrInfos);
+        this.updateTitleFromComponentClass();
+    }
 
 
+    private updateTitleFromComponentClass() {
+        this.text = this.editType.typeName;
+        let jsc = this.editType.getFirstObject() as Atomic.JSComponent;
+        if (jsc && jsc.componentFile) {
+            this.text = jsc.componentFile.name.split("/").pop();
+        }
     }
     }
 
 
 }
 }