From 24c6741d594b9d4167cd4de407a625eb43ebe7cc Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Sat, 23 Jun 2012 13:58:16 -0700 Subject: Binding View: Fixed If Selected Div Erroring Out Signed-off-by: Armen Kesablyan --- js/panels/binding/binding-item.reel/binding-item.js | 12 ------------ js/stage/binding-view.reel/binding-view.js | 6 ++++-- js/tools/bindingTool.js | 9 ++++++++- 3 files changed, 12 insertions(+), 15 deletions(-) (limited to 'js') 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, { /* -------------- Component Draw Cycle -------------- */ - templateDidLoad : { - value: function() { - console.log("loaded binding item"); - } - }, - - prepareForDraw: { - value: function() { - console.log("preparing to draw binding item"); - } - }, - draw : { value: function() { 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, { this._selectedComponent = val; if(this._selectedComponent !== null) { this.application.ninja.objectsController.currentObject = this.selectedComponent; - this.boundComponents.push(this.selectedComponent); + if (this.selectedComponent !== null) { + this.boundComponents.push(this.selectedComponent); + } } this.needsDraw = true; } @@ -217,7 +219,7 @@ exports.BindingView = Montage.create(Component, { this.element.style.removeProperty('display'); this.element.style.width = this.width + "px"; this.element.style.height = this.height + "px"; - if(this.selectedComponent !== null) { + if(this.selectedComponent !== null && typeof(this.selectedComponent) !== "undefined") { this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth; this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight; 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, { NJevent("enableStageMove"); this.application.ninja.workspaceMode = "binding"; if (this.application.ninja.selectedElements.length !== 0 ) { - this.selectedComponent = this.application.ninja.selectedElements[0].controller; + if(typeof(this.application.ninja.selectedElements[0].controller) !== "undefined") { + this.selectedComponent = this.application.ninja.selectedElements[0].controller; + } else { + this.selectedComponent = null; + } + } } else @@ -81,6 +86,8 @@ exports.BindingTool = Montage.create(ModifierToolBase, { if (this.application.ninja.selectedElements.length !== 0 ) { if(this.application.ninja.selectedElements[0].controller) { this.selectedComponent = this.application.ninja.selectedElements[0].controller; + } else { + this.selectedComponent = null; } } else { this.selectedComponent = null; -- cgit v1.2.3