aboutsummaryrefslogtreecommitdiff
path: root/js/stage/binding-view.reel/binding-view.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage/binding-view.reel/binding-view.js')
-rwxr-xr-xjs/stage/binding-view.reel/binding-view.js38
1 files changed, 16 insertions, 22 deletions
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js
index 1fc4d583..9e1b3e22 100755
--- a/js/stage/binding-view.reel/binding-view.js
+++ b/js/stage/binding-view.reel/binding-view.js
@@ -97,20 +97,20 @@ exports.BindingView = Montage.create(Component, {
97 } 97 }
98 }, 98 },
99 99
100 _selectedComponent: { value: null }, 100 _selectedElement: { value: null },
101 selectedComponent: { 101 selectedElement: {
102 get: function() { 102 get: function() {
103 return this._selectedComponent; 103 return this._selectedElement;
104 }, 104 },
105 set: function(val) { 105 set: function(val) {
106 this.boundComponents = []; 106 this.boundComponents = [];
107 if(this._selectedComponent !== val) { 107 if(this._selectedElement !== val) {
108 this.clearCanvas(); 108 this.clearCanvas();
109 this._selectedComponent = val; 109 this._selectedElement = val;
110 if(this._selectedComponent !== null) { 110 if(this._selectedElement !== null) {
111 this.application.ninja.objectsController.currentObject = this.selectedComponent; 111 this.application.ninja.objectsController.currentObject = this._selectedElement.controller;
112 if (this.selectedComponent !== null) { 112 if (this._selectedElement !== null) {
113 this.boundComponents.push(this.selectedComponent); 113 this.boundComponents.push(this._selectedElement);
114 } 114 }
115 } 115 }
116 this.needsDraw = true; 116 this.needsDraw = true;
@@ -198,7 +198,7 @@ exports.BindingView = Montage.create(Component, {
198 } 198 }
199 }, 199 },
200 200
201 _hide : { value: null }, 201 _hide : { value: true },
202 hide : { 202 hide : {
203 get : function() { return this._hide; }, 203 get : function() { return this._hide; },
204 set : function(value) { 204 set : function(value) {
@@ -219,12 +219,12 @@ exports.BindingView = Montage.create(Component, {
219 this.element.style.removeProperty('display'); 219 this.element.style.removeProperty('display');
220 this.element.style.width = this.width + "px"; 220 this.element.style.width = this.width + "px";
221 this.element.style.height = this.height + "px"; 221 this.element.style.height = this.height + "px";
222 if(this.selectedComponent !== null && typeof(this.selectedComponent) !== "undefined") { 222 if(this._selectedElement !== null && typeof(this._selectedElement) !== "undefined") {
223 this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth; 223 this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth;
224 this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight; 224 this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight;
225 this.clearCanvas(); 225 this.clearCanvas();
226 for(var i= 0; i < this.hudRepeater.childComponents.length; i++) { 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); 227 this.drawLine(this.hudRepeater.objects[i].offsetLeft,this.hudRepeater.objects[i].offsetTop, this.hudRepeater.childComponents[i].element.offsetLeft +1, this.hudRepeater.childComponents[i].element.offsetTop +1, "#CCC", 2);
228 } 228 }
229 if(this._isDrawingConnection) { 229 if(this._isDrawingConnection) {
230 if (this.hudRepeater.childComponents.length > 1) { 230 if (this.hudRepeater.childComponents.length > 1) {
@@ -247,12 +247,6 @@ exports.BindingView = Montage.create(Component, {
247 } 247 }
248 }, 248 },
249 249
250 didDraw: {
251 value: function() {
252
253 }
254 },
255
256 drawLine: { 250 drawLine: {
257 value: function(fromX,fromY,toX,toY, color, width) { 251 value: function(fromX,fromY,toX,toY, color, width) {
258 if(width === null) width = 1; 252 if(width === null) width = 1;
@@ -347,7 +341,7 @@ exports.BindingView = Montage.create(Component, {
347 if(this._isDrawingConnection && !overHud) { 341 if(this._isDrawingConnection && !overHud) {
348 //NOTE : Continue This content. mouse over select 342 //NOTE : Continue This content. mouse over select
349 var obj = this.application.ninja.stage.getElement(event, true); 343 var obj = this.application.ninja.stage.getElement(event, true);
350 if (obj && obj.controller !== this.selectedComponent) 344 if (obj && obj !== this.selectedElement)
351 { 345 {
352 if (!obj.controller || obj === null) 346 if (!obj.controller || obj === null)
353 { 347 {
@@ -369,7 +363,7 @@ exports.BindingView = Montage.create(Component, {
369 } 363 }
370 this._targetedElement = obj; 364 this._targetedElement = obj;
371 this._targetedElement.classList.add("active-element-outline"); 365 this._targetedElement.classList.add("active-element-outline");
372 this.boundComponents.push(this._targetedElement.controller); 366 this.boundComponents.push(this._targetedElement);
373 } 367 }
374 } 368 }
375 } 369 }
@@ -392,7 +386,7 @@ exports.BindingView = Montage.create(Component, {
392// var mouseUpPoint = new WebKitPoint(e.pageX, e.pageY); 386// var mouseUpPoint = new WebKitPoint(e.pageX, e.pageY);
393// var nodeEl = new webkitConvertPointFromPageToNode(this.element, mouseUpPoint); 387// var nodeEl = new webkitConvertPointFromPageToNode(this.element, mouseUpPoint);
394 //debugger; 388 //debugger;
395 this.connectionElementEnd = nodeEl.parentElement.controller.parentComponent.parentComponent.userComponent; 389 this.connectionElementEnd = nodeEl.parentElement.controller.parentComponent.parentComponent.userElement.controller;
396 this.connectionPropertyEnd = nodeEl.parentElement.controller.title; 390 this.connectionPropertyEnd = nodeEl.parentElement.controller.title;
397 this.application.ninja.objectsController.addBinding({ 391 this.application.ninja.objectsController.addBinding({
398 sourceObject: this.connectionElementStart, 392 sourceObject: this.connectionElementStart,
@@ -415,7 +409,7 @@ exports.BindingView = Montage.create(Component, {
415 value: function(e) { 409 value: function(e) {
416 // We are looking for a mouse down on an option to start the connection visual 410 // We are looking for a mouse down on an option to start the connection visual
417 if(e._event.target.classList.contains("connectorBubble")) { 411 if(e._event.target.classList.contains("connectorBubble")) {
418 this.connectionElementStart = e._event.target.parentElement.controller.parentComponent.parentComponent.userComponent; 412 this.connectionElementStart = e._event.target.parentElement.controller.parentComponent.parentComponent.userElement.controller;
419 this.connectionPropertyStart = e._event.target.parentElement.controller.title; 413 this.connectionPropertyStart = e._event.target.parentElement.controller.title;
420 this._isDrawingConnection = true; 414 this._isDrawingConnection = true;
421 this._connectionPositionStart = webkitConvertPointFromPageToNode(this.element, new WebKitPoint(e.pageX, e.pageY)); 415 this._connectionPositionStart = webkitConvertPointFromPageToNode(this.element, new WebKitPoint(e.pageX, e.pageY));