diff options
author | Armen Kesablyan | 2012-06-14 15:00:18 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-14 15:00:18 -0700 |
commit | 60e9ea67e0f6d0cf167b6d5068e2e01db5f67966 (patch) | |
tree | 3795f52327f6e3da53d1689d5e67a3164722e357 | |
parent | d2e2a39feeba51e976d139eddf6f1cf331457f4f (diff) | |
download | ninja-60e9ea67e0f6d0cf167b6d5068e2e01db5f67966.tar.gz |
Binding-Huds draw to component
Signed-off-by: Armen Kesablyan <armen@motorola.com>
4 files changed, 35 insertions, 9 deletions
diff --git a/js/stage/binding-view.reel/binding-hud-option.reel/binding-hud-option.js b/js/stage/binding-view.reel/binding-hud-option.reel/binding-hud-option.js index 3eda272c..6db86a78 100755 --- a/js/stage/binding-view.reel/binding-hud-option.reel/binding-hud-option.js +++ b/js/stage/binding-view.reel/binding-hud-option.reel/binding-hud-option.js | |||
@@ -51,6 +51,12 @@ exports.BindingHudOption = Montage.create(Component, { | |||
51 | } | 51 | } |
52 | }, | 52 | }, |
53 | 53 | ||
54 | prepareForDraw: { | ||
55 | value: function() { | ||
56 | // Set Up Listener for click and propagate up to Binding View | ||
57 | } | ||
58 | }, | ||
59 | |||
54 | draw: { | 60 | draw: { |
55 | value:function() { | 61 | value:function() { |
56 | if(this.bound) { | 62 | if(this.bound) { |
diff --git a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js index 5053d3bb..4260a66c 100755 --- a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js +++ b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js | |||
@@ -62,6 +62,7 @@ exports.BindingHud = Montage.create(Component, { | |||
62 | this.x = parseInt(this.x); | 62 | this.x = parseInt(this.x); |
63 | this.y = parseInt(this.y); | 63 | this.y = parseInt(this.y); |
64 | this.needsDraw = true; | 64 | this.needsDraw = true; |
65 | this.parentComponent.parentComponent.needsDraw = true; | ||
65 | } | 66 | } |
66 | }, | 67 | }, |
67 | 68 | ||
@@ -70,6 +71,7 @@ exports.BindingHud = Montage.create(Component, { | |||
70 | this._resizedY = e._event.dY; | 71 | this._resizedY = e._event.dY; |
71 | this._resizedX = e._event.dX; | 72 | this._resizedX = e._event.dX; |
72 | this.needsDraw = true; | 73 | this.needsDraw = true; |
74 | this.parentComponent.parentComponent.needsDraw = true; | ||
73 | } | 75 | } |
74 | }, | 76 | }, |
75 | 77 | ||
@@ -81,6 +83,7 @@ exports.BindingHud = Montage.create(Component, { | |||
81 | this._resizedY = 0; | 83 | this._resizedY = 0; |
82 | this.isResizing = false; | 84 | this.isResizing = false; |
83 | this.needsDraw = true; | 85 | this.needsDraw = true; |
86 | this.parentComponent.parentComponent.needsDraw = true; | ||
84 | } | 87 | } |
85 | }, | 88 | }, |
86 | 89 | ||
@@ -98,7 +101,6 @@ exports.BindingHud = Montage.create(Component, { | |||
98 | }, | 101 | }, |
99 | set: function(val) { | 102 | set: function(val) { |
100 | this._x = val; | 103 | this._x = val; |
101 | console.log(this._x); | ||
102 | this.needsDraw = true; | 104 | this.needsDraw = true; |
103 | } | 105 | } |
104 | }, | 106 | }, |
@@ -149,7 +151,6 @@ exports.BindingHud = Montage.create(Component, { | |||
149 | // } | 151 | // } |
150 | this.element.style.top = (this.y + this._resizedY) + "px"; | 152 | this.element.style.top = (this.y + this._resizedY) + "px"; |
151 | this.element.style.left = (this.x + this._resizedX) + "px"; | 153 | this.element.style.left = (this.x + this._resizedX) + "px"; |
152 | console.log("hud",this); | ||
153 | } | 154 | } |
154 | } | 155 | } |
155 | }); \ No newline at end of file | 156 | }); \ No newline at end of file |
diff --git a/js/stage/binding-view.reel/binding-view.html b/js/stage/binding-view.reel/binding-view.html index 8abddbee..c7520132 100755 --- a/js/stage/binding-view.reel/binding-view.html +++ b/js/stage/binding-view.reel/binding-view.html | |||
@@ -35,7 +35,13 @@ | |||
35 | }, | 35 | }, |
36 | "bindings": { | 36 | "bindings": { |
37 | "bindingArgs": {"<-": "@hudRepeater.objectAtCurrentIteration"} | 37 | "bindingArgs": {"<-": "@hudRepeater.objectAtCurrentIteration"} |
38 | } | 38 | }, |
39 | "listeners": [ | ||
40 | { | ||
41 | "type": "resizeMove", | ||
42 | "listener": {"@": "owner"} | ||
43 | } | ||
44 | ] | ||
39 | }, | 45 | }, |
40 | "nonVisualRepeater": { | 46 | "nonVisualRepeater": { |
41 | "prototype": "montage/ui/repetition.reel", | 47 | "prototype": "montage/ui/repetition.reel", |
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js index b0df6df1..58a4cf06 100755 --- a/js/stage/binding-view.reel/binding-view.js +++ b/js/stage/binding-view.reel/binding-view.js | |||
@@ -94,6 +94,9 @@ exports.BindingView = Montage.create(Component, { | |||
94 | return this._selectedComponent; | 94 | return this._selectedComponent; |
95 | }, | 95 | }, |
96 | set: function(val) { | 96 | set: function(val) { |
97 | if(this._selectedComponent !== val) { | ||
98 | this.bindables = []; | ||
99 | this.clearCanvas(); | ||
97 | this._selectedComponent = val; | 100 | this._selectedComponent = val; |
98 | if(this._selectedComponent !== null) { | 101 | if(this._selectedComponent !== null) { |
99 | this.application.ninja.objectsController.currentObject = this.selectedComponent; | 102 | this.application.ninja.objectsController.currentObject = this.selectedComponent; |
@@ -128,9 +131,17 @@ exports.BindingView = Montage.create(Component, { | |||
128 | 131 | ||
129 | //Get Properties of Elements in bindings; | 132 | //Get Properties of Elements in bindings; |
130 | } | 133 | } |
131 | this.needsDraw = true; | 134 | this.needsDraw = true; |
135 | } | ||
132 | } | 136 | } |
133 | }, | 137 | }, |
138 | |||
139 | handleResizeMove: { | ||
140 | value: function(e) { | ||
141 | console.log(e); | ||
142 | } | ||
143 | }, | ||
144 | |||
134 | bindables: { | 145 | bindables: { |
135 | get: function() { | 146 | get: function() { |
136 | return this._bindables; | 147 | return this._bindables; |
@@ -169,8 +180,8 @@ exports.BindingView = Montage.create(Component, { | |||
169 | //Montage Draw Cycle | 180 | //Montage Draw Cycle |
170 | prepareForDraw: { | 181 | prepareForDraw: { |
171 | value: function() { | 182 | value: function() { |
172 | //this._canvas = this.application.ninja.stage.drawingCanvas; | 183 | this._canvas = this.application.ninja.stage.drawingCanvas; |
173 | this._context = this._canvas.getContext('2d'); | 184 | this._context = this.application.ninja.stage.drawingCanvas.getContext('2d'); |
174 | this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); | 185 | this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); |
175 | } | 186 | } |
176 | }, | 187 | }, |
@@ -181,8 +192,9 @@ exports.BindingView = Montage.create(Component, { | |||
181 | this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth; | 192 | this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth; |
182 | this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight; | 193 | this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight; |
183 | this.clearCanvas(); | 194 | this.clearCanvas(); |
184 | this.drawBlueLine(110,53,210,173); | 195 | for(var i= 0; i < this.hudRepeater.childComponents.length; i++) { |
185 | 196 | this.drawBlueLine(this.hudRepeater.objects[i].component.element.offsetLeft,this.hudRepeater.objects[i].component.element.offsetTop, this.hudRepeater.childComponents[i].element.offsetLeft, this.hudRepeater.childComponents[i].element.offsetTop); | |
197 | } | ||
186 | } else { | 198 | } else { |
187 | this.bindables = []; | 199 | this.bindables = []; |
188 | this.clearCanvas(); | 200 | this.clearCanvas(); |
@@ -200,7 +212,7 @@ exports.BindingView = Montage.create(Component, { | |||
200 | drawBlueLine: { | 212 | drawBlueLine: { |
201 | value: function(fromX,fromY,toX,toY) { | 213 | value: function(fromX,fromY,toX,toY) { |
202 | this._context.lineWidth = 4; // Set Line Thickness | 214 | this._context.lineWidth = 4; // Set Line Thickness |
203 | this._context.strokeStyle = "#5e9eff" | 215 | //this._context.strokeStyle = "#5e9eff"; |
204 | 216 | ||
205 | this._context.beginPath(); // Start Drawing Line | 217 | this._context.beginPath(); // Start Drawing Line |
206 | this._context.moveTo(fromX, fromY); | 218 | this._context.moveTo(fromX, fromY); |
@@ -211,6 +223,7 @@ exports.BindingView = Montage.create(Component, { | |||
211 | 223 | ||
212 | clearCanvas: { | 224 | clearCanvas: { |
213 | value: function() { | 225 | value: function() { |
226 | debugger; | ||
214 | this._context.clearRect(0,0,this._canvas.offsetWidth,this._canvas.offsetHeight); | 227 | this._context.clearRect(0,0,this._canvas.offsetWidth,this._canvas.offsetHeight); |
215 | } | 228 | } |
216 | }, | 229 | }, |