diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/stage/binding-view.reel/binding-view.js | 84 |
1 files changed, 63 insertions, 21 deletions
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js index 73d25824..9f4e7809 100755 --- a/js/stage/binding-view.reel/binding-view.js +++ b/js/stage/binding-view.reel/binding-view.js | |||
@@ -170,36 +170,78 @@ exports.BindingView = Montage.create(Component, { | |||
170 | this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); | 170 | this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); |
171 | this.element.addEventListener("mousedown", this, false); | 171 | this.element.addEventListener("mousedown", this, false); |
172 | this.element.addEventListener("mousemove", this, false); | 172 | this.element.addEventListener("mousemove", this, false); |
173 | |||
174 | Object.defineBinding(this, 'currentDocument', { | ||
175 | boundObject : this.application.ninja, | ||
176 | boundObjectPropertyPath : "documentList.selectedObjects.0", | ||
177 | oneway: true | ||
178 | }); | ||
179 | |||
180 | } | ||
181 | }, | ||
182 | |||
183 | _currentDocument : { value: null }, | ||
184 | currentDocument : { | ||
185 | get : function() { return this._currentDocument; }, | ||
186 | set : function(value) { | ||
187 | if(value === this._currentDocument) { return; } | ||
188 | |||
189 | |||
190 | this._currentDocument = value; | ||
191 | if(value) { | ||
192 | this.hide = (value.currentView === 'code'); | ||
193 | } | ||
194 | |||
195 | this.needsDraw = true; | ||
196 | } | ||
197 | }, | ||
198 | |||
199 | _hide : { value: null }, | ||
200 | hide : { | ||
201 | get : function() { return this._hide; }, | ||
202 | set : function(value) { | ||
203 | if(value === this._hide) { return; } | ||
204 | |||
205 | this._hide = value; | ||
206 | |||
207 | this.needsDraw = true; | ||
173 | } | 208 | } |
174 | }, | 209 | }, |
175 | 210 | ||
176 | draw: { | 211 | draw: { |
177 | value: function() { | 212 | value: function() { |
178 | 213 | ||
179 | this.element.style.width = this.width + "px"; | 214 | if(this.hide) { |
180 | this.element.style.height = this.height + "px"; | 215 | console.log('hiding vinding view'); |
181 | if(this.selectedComponent !== null) { | 216 | this.element.style.setProperty('display', 'none'); |
182 | this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth; | 217 | } else { |
183 | this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight; | 218 | console.log("showing binding view"); |
184 | this.clearCanvas(); | 219 | this.element.style.removeProperty('display'); |
185 | for(var i= 0; i < this.hudRepeater.childComponents.length; i++) { | 220 | this.element.style.width = this.width + "px"; |
186 | this.drawLine(this.hudRepeater.objects[i].element.offsetLeft,this.hudRepeater.objects[i].element.offsetTop, this.hudRepeater.childComponents[i].element.offsetLeft +3, this.hudRepeater.childComponents[i].element.offsetTop +3, "#CCC", 2); | 221 | this.element.style.height = this.height + "px"; |
187 | } | 222 | if(this.selectedComponent !== null) { |
188 | if(this._isDrawingConnection) { | 223 | this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth; |
189 | if (this.hudRepeater.childComponents.length > 1) { | 224 | this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight; |
190 | // Make things disappear | 225 | this.clearCanvas(); |
226 | for(var i= 0; i < this.hudRepeater.childComponents.length; i++) { | ||
227 | this.drawLine(this.hudRepeater.objects[i].element.offsetLeft,this.hudRepeater.objects[i].element.offsetTop, this.hudRepeater.childComponents[i].element.offsetLeft +3, this.hudRepeater.childComponents[i].element.offsetTop +3, "#CCC", 2); | ||
191 | } | 228 | } |
192 | this.drawLine(this._currentMousePosition.x,this._currentMousePosition.y,this._connectionPositionStart.x,this._connectionPositionStart.y,"#5e9eff", 4); | 229 | if(this._isDrawingConnection) { |
230 | if (this.hudRepeater.childComponents.length > 1) { | ||
231 | // Make things disappear | ||
232 | } | ||
233 | this.drawLine(this._currentMousePosition.x,this._currentMousePosition.y,this._connectionPositionStart.x,this._connectionPositionStart.y,"#5e9eff", 4); | ||
234 | } | ||
235 | } else { | ||
236 | this.bindables = []; | ||
237 | this.clearCanvas(); | ||
193 | } | 238 | } |
194 | } else { | ||
195 | this.bindables = []; | ||
196 | this.clearCanvas(); | ||
197 | } | ||
198 | 239 | ||
199 | if(this.mouseOverHud && !this._isDrawingConnection) { | 240 | if(this.mouseOverHud && !this._isDrawingConnection) { |
200 | if(!this.element.classList.contains("mousedOverHud")) { this.element.classList.add("mousedOverHud"); } | 241 | if(!this.element.classList.contains("mousedOverHud")) { this.element.classList.add("mousedOverHud"); } |
201 | } else { | 242 | } else { |
202 | if(this.element.classList.contains("mousedOverHud")) { this.element.classList.remove("mousedOverHud"); } | 243 | if(this.element.classList.contains("mousedOverHud")) { this.element.classList.remove("mousedOverHud"); } |
244 | } | ||
203 | } | 245 | } |
204 | 246 | ||
205 | } | 247 | } |