diff options
Diffstat (limited to 'js/panels/objects/object.reel/object.js')
-rw-r--r-- | js/panels/objects/object.reel/object.js | 30 |
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 | ||
14 | exports.Object = Montage.create(Component, { | 14 | exports.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 | } |