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 /js/stage/binding-view.reel/binding-view.js | |
parent | d2e2a39feeba51e976d139eddf6f1cf331457f4f (diff) | |
download | ninja-60e9ea67e0f6d0cf167b6d5068e2e01db5f67966.tar.gz |
Binding-Huds draw to component
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/stage/binding-view.reel/binding-view.js')
-rwxr-xr-x | js/stage/binding-view.reel/binding-view.js | 25 |
1 files changed, 19 insertions, 6 deletions
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 | }, |