aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-23 13:58:16 -0700
committerArmen Kesablyan2012-06-23 13:58:16 -0700
commit24c6741d594b9d4167cd4de407a625eb43ebe7cc (patch)
tree7781f7a12abb0484363a805c44d1a52046b35d37 /js
parent3c9d7334cac82f66adbdb2cce55a73c4c51ae413 (diff)
downloadninja-24c6741d594b9d4167cd4de407a625eb43ebe7cc.tar.gz
Binding View: Fixed If Selected Div Erroring Out
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/panels/binding/binding-item.reel/binding-item.js12
-rwxr-xr-xjs/stage/binding-view.reel/binding-view.js6
-rw-r--r--js/tools/bindingTool.js9
3 files changed, 12 insertions, 15 deletions
diff --git a/js/panels/binding/binding-item.reel/binding-item.js b/js/panels/binding/binding-item.reel/binding-item.js
index a1017020..adc6320c 100644
--- a/js/panels/binding/binding-item.reel/binding-item.js
+++ b/js/panels/binding/binding-item.reel/binding-item.js
@@ -106,18 +106,6 @@ exports.BindingItem = Montage.create(Component, {
106 106
107 /* -------------- Component Draw Cycle -------------- */ 107 /* -------------- Component Draw Cycle -------------- */
108 108
109 templateDidLoad : {
110 value: function() {
111 console.log("loaded binding item");
112 }
113 },
114
115 prepareForDraw: {
116 value: function() {
117 console.log("preparing to draw binding item");
118 }
119 },
120
121 draw : { 109 draw : {
122 value: function() { 110 value: function() {
123 if(this.oneway) { 111 if(this.oneway) {
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js
index c2407b13..1fc4d583 100755
--- a/js/stage/binding-view.reel/binding-view.js
+++ b/js/stage/binding-view.reel/binding-view.js
@@ -109,7 +109,9 @@ exports.BindingView = Montage.create(Component, {
109 this._selectedComponent = val; 109 this._selectedComponent = val;
110 if(this._selectedComponent !== null) { 110 if(this._selectedComponent !== null) {
111 this.application.ninja.objectsController.currentObject = this.selectedComponent; 111 this.application.ninja.objectsController.currentObject = this.selectedComponent;
112 this.boundComponents.push(this.selectedComponent); 112 if (this.selectedComponent !== null) {
113 this.boundComponents.push(this.selectedComponent);
114 }
113 } 115 }
114 this.needsDraw = true; 116 this.needsDraw = true;
115 } 117 }
@@ -217,7 +219,7 @@ exports.BindingView = Montage.create(Component, {
217 this.element.style.removeProperty('display'); 219 this.element.style.removeProperty('display');
218 this.element.style.width = this.width + "px"; 220 this.element.style.width = this.width + "px";
219 this.element.style.height = this.height + "px"; 221 this.element.style.height = this.height + "px";
220 if(this.selectedComponent !== null) { 222 if(this.selectedComponent !== null && typeof(this.selectedComponent) !== "undefined") {
221 this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth; 223 this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth;
222 this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight; 224 this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight;
223 this.clearCanvas(); 225 this.clearCanvas();
diff --git a/js/tools/bindingTool.js b/js/tools/bindingTool.js
index b284fc47..1e1c9e5b 100644
--- a/js/tools/bindingTool.js
+++ b/js/tools/bindingTool.js
@@ -34,7 +34,12 @@ exports.BindingTool = Montage.create(ModifierToolBase, {
34 NJevent("enableStageMove"); 34 NJevent("enableStageMove");
35 this.application.ninja.workspaceMode = "binding"; 35 this.application.ninja.workspaceMode = "binding";
36 if (this.application.ninja.selectedElements.length !== 0 ) { 36 if (this.application.ninja.selectedElements.length !== 0 ) {
37 this.selectedComponent = this.application.ninja.selectedElements[0].controller; 37 if(typeof(this.application.ninja.selectedElements[0].controller) !== "undefined") {
38 this.selectedComponent = this.application.ninja.selectedElements[0].controller;
39 } else {
40 this.selectedComponent = null;
41 }
42
38 } 43 }
39 } 44 }
40 else 45 else
@@ -81,6 +86,8 @@ exports.BindingTool = Montage.create(ModifierToolBase, {
81 if (this.application.ninja.selectedElements.length !== 0 ) { 86 if (this.application.ninja.selectedElements.length !== 0 ) {
82 if(this.application.ninja.selectedElements[0].controller) { 87 if(this.application.ninja.selectedElements[0].controller) {
83 this.selectedComponent = this.application.ninja.selectedElements[0].controller; 88 this.selectedComponent = this.application.ninja.selectedElements[0].controller;
89 } else {
90 this.selectedComponent = null;
84 } 91 }
85 } else { 92 } else {
86 this.selectedComponent = null; 93 this.selectedComponent = null;