aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/controllers/objects-controller.js14
-rw-r--r--js/panels/objects/object.reel/object.js16
-rw-r--r--js/stage/objects-tray.reel/objects-tray.html8
-rw-r--r--js/stage/objects-tray.reel/objects-tray.js23
4 files changed, 53 insertions, 8 deletions
diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js
index b8efd432..54ff14ba 100644
--- a/js/controllers/objects-controller.js
+++ b/js/controllers/objects-controller.js
@@ -190,6 +190,8 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, {
190 } 190 }
191 }, 191 },
192 192
193 /* ----- Utils ----- */
194
193 _hasPrototype : { 195 _hasPrototype : {
194 value: function(object, prototypeName) { 196 value: function(object, prototypeName) {
195 var prototypes = this.getPrototypes(object).map(function(proto) { 197 var prototypes = this.getPrototypes(object).map(function(proto) {
@@ -201,6 +203,18 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, {
201 } 203 }
202 }, 204 },
203 205
206 ///// Returns true if the element is "non-visual", i.e. is not a component,
207 ///// and has not element property
208
209 isOffStageObject : {
210 value: function(object) {
211 var isComponent = this._hasPrototype(object, "Component"),
212 hasValidElement = object.element && object.element.parentNode;
213
214 return !isComponent || !hasValidElement;
215 }
216 },
217
204 /* ---- Bindable controller properties ---- */ 218 /* ---- Bindable controller properties ---- */
205 219
206 currentObjectBindings : { 220 currentObjectBindings : {
diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js
index 76f1b5bf..b8bf1b1e 100644
--- a/js/panels/objects/object.reel/object.js
+++ b/js/panels/objects/object.reel/object.js
@@ -75,6 +75,22 @@ exports.Object = Montage.create(Component, {
75 75
76 }, 76 },
77 77
78 /* ---------------------
79 Event Handlers
80 --------------------- */
81
82 handleClick: {
83 value: function(e) {
84 this.parentComponent.parentComponent.displayHUDForObject(this.sourceObject);
85 }
86 },
87
88 prepareForDraw : {
89 value: function() {
90 this.iconElement.addEventListener('click', this, false);
91 }
92 },
93
78 draw : { 94 draw : {
79 value: function() { 95 value: function() {
80 if(this.type) { 96 if(this.type) {
diff --git a/js/stage/objects-tray.reel/objects-tray.html b/js/stage/objects-tray.reel/objects-tray.html
index 710e3edf..5a0db85e 100644
--- a/js/stage/objects-tray.reel/objects-tray.html
+++ b/js/stage/objects-tray.reel/objects-tray.html
@@ -39,7 +39,13 @@
39 "bindings": { 39 "bindings": {
40 "sourceObject" : {"<-": "@repetition.objectAtCurrentIteration"}, 40 "sourceObject" : {"<-": "@repetition.objectAtCurrentIteration"},
41 "identifier" : {"<-": "@repetition.objectAtCurrentIteration.identifier"} 41 "identifier" : {"<-": "@repetition.objectAtCurrentIteration.identifier"}
42 } 42 },
43 "listeners": [
44 {
45 "type": "click",
46 "listener": {"@": "owner"}
47 }
48 ]
43 } 49 }
44 50
45 } 51 }
diff --git a/js/stage/objects-tray.reel/objects-tray.js b/js/stage/objects-tray.reel/objects-tray.js
index 3872c8b6..360d6037 100644
--- a/js/stage/objects-tray.reel/objects-tray.js
+++ b/js/stage/objects-tray.reel/objects-tray.js
@@ -66,10 +66,7 @@ exports.ObjectsTray = Montage.create(Component, {
66 return true; 66 return true;
67 } 67 }
68 68
69 var isComponent = this.application.ninja.objectsController._hasPrototype(obj, "Component"), 69 return this.application.ninja.objectsController.isOffStageObject(obj);
70 hasValidElement = obj.element && obj.element.parentNode;
71
72 return !isComponent || !hasValidElement;
73 } 70 }
74 }, 71 },
75 72
@@ -85,6 +82,15 @@ exports.ObjectsTray = Montage.create(Component, {
85 } 82 }
86 }, 83 },
87 84
85 displayHUDForObject : {
86 value: function(object) {
87 this.parentComponent.boundComponents.push(object);
88 }
89 },
90
91 /* ---------------------
92 Draw Cycle
93 --------------------- */
88 94
89 templateDidLoad: { 95 templateDidLoad: {
90 value: function() { 96 value: function() {
@@ -107,12 +113,15 @@ exports.ObjectsTray = Montage.create(Component, {
107 "oneway": true 113 "oneway": true
108 }); 114 });
109 115
116 }
117 },
118 willDraw : {
119 value: function() {
110 if(this.objects) { 120 if(this.objects) {
111 this.empty = !this.objects.length; 121 this._empty = !this.offStageObjectsController.organizedObjects.length;
112 } else { 122 } else {
113 this.empty = true; 123 this._empty = true;
114 } 124 }
115
116 } 125 }
117 }, 126 },
118 draw : { 127 draw : {