aboutsummaryrefslogtreecommitdiff
path: root/js/panels/objects/object.reel/object.js
diff options
context:
space:
mode:
authorEric Guzman2012-06-11 10:27:49 -0700
committerEric Guzman2012-06-11 10:27:49 -0700
commita9a6d479e4f00134b32f7c3e657de3ce5cfb0c48 (patch)
treea23d8251de71e94e6d1e8c698e94319f4194d941 /js/panels/objects/object.reel/object.js
parentdbb36888eda1f25387852ea79aef89d22dfd7799 (diff)
downloadninja-a9a6d479e4f00134b32f7c3e657de3ce5cfb0c48.tar.gz
Objects Panel - Add component icon and icons by type
Diffstat (limited to 'js/panels/objects/object.reel/object.js')
-rw-r--r--js/panels/objects/object.reel/object.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js
index 43abafad..1e33b7f7 100644
--- a/js/panels/objects/object.reel/object.js
+++ b/js/panels/objects/object.reel/object.js
@@ -13,6 +13,16 @@ var Montage = require("montage/core/core").Montage,
13 13
14exports.Object = Montage.create(Component, { 14exports.Object = Montage.create(Component, {
15 _needsPropertyInspection : { value: null }, 15 _needsPropertyInspection : { value: null },
16 type: { value: null },
17 getType : {
18 value: function() {
19 if(this._hasPrototype(this.sourceObject, 'Component')) {
20 return 'Component';
21 }
22
23 return null;
24 }
25 },
16 26
17 _sourceObject : { value: null }, 27 _sourceObject : { value: null },
18 sourceObject : { 28 sourceObject : {
@@ -22,8 +32,11 @@ exports.Object = Montage.create(Component, {
22 set: function(object) { 32 set: function(object) {
23 if(this._sourceObject === object) { return false; } 33 if(this._sourceObject === object) { return false; }
24 34
35 this._sourceObject = object;
36
25 if(object._montage_metadata) { 37 if(object._montage_metadata) {
26 this.montageMetaData = object._montage_metadata; 38 this.montageMetaData = object._montage_metadata;
39 this.type = this.getType();
27 } 40 }
28 41
29 this._needsPropertyInspection = this.needsDraw = true; 42 this._needsPropertyInspection = this.needsDraw = true;
@@ -70,8 +83,25 @@ exports.Object = Montage.create(Component, {
70 83
71 }, 84 },
72 85
86 _hasPrototype : {
87 value: function(object, prototypeName) {
88 var prototypes = this.application.ninja.objectsController.getPrototypes(object).map(function(proto) {
89 var metadata = proto._montage_metadata;
90 return (metadata) ? metadata.objectName : "Object";
91 });
92
93 return prototypes.indexOf(prototypeName) !== -1;
94 }
95 },
96
73 draw : { 97 draw : {
74 value: function() { 98 value: function() {
99 if(this.type) {
100 this.element.classList.add('object-icon-'+this.type.toLowerCase());
101 } else{
102 this.element.classList.add('object-icon-default');
103 }
104
75 105
76 } 106 }
77 } 107 }