Browse Source

Merge pull request #1158 from AtomicGameEngine/TSH-ATOMIC-177

Fixes #177 - Display name of JS file in inspector when a JS component is selected
JoshEngebretson 9 years ago
parent
commit
4a9dbb2f3d
1 changed files with 9 additions and 1 deletions
  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.subscribeToEvent(this, "AttributeEditResourceChanged", (ev) => this.handleAttributeEditResourceChanged(ev));
-
+        this.updateTitleFromComponentClass();
     }
 
     private handleAttributeEditResourceChanged(ev: AttributeEditResourceChangedEvent) {
@@ -157,7 +157,15 @@ class JSComponentSection extends ComponentSection {
 
         var attrInfos = jsc.getAttributes();
         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();
+        }
     }
 
 }