From 4bd8b5ce3286d472fd852dc53ef07e90aadfb7e9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 9 Feb 2012 08:47:33 -0800 Subject: Fixed runtime error when using 3d tools without any items selected. Signed-off-by: Nivesh Rajbhandari --- js/tools/modifier-tool-base.js | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'js/tools/modifier-tool-base.js') diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js index f78e99c8..67b217c4 100644 --- a/js/tools/modifier-tool-base.js +++ b/js/tools/modifier-tool-base.js @@ -437,16 +437,19 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { startDraw: { value: function(event) { - this.isDrawing = true; - this.application.ninja.stage.showSelectionBounds = false; - - if(this._canSnap) - { - this.initializeSnapping(event); - } - else + if(this._target) { - this.drawWithoutSnapping(event); + this.isDrawing = true; + this.application.ninja.stage.showSelectionBounds = false; + + if(this._canSnap) + { + this.initializeSnapping(event); + } + else + { + this.drawWithoutSnapping(event); + } } } }, @@ -674,11 +677,15 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { return this._targets; }, set: function (value) { - this._target = value; - if (value === null) + this._targets = value; + if (value !== null && value.length) { - return; + this.target = value[0]; } + else + { + this.target = null; + } } }, @@ -723,7 +730,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { } else { this.eventManager.removeEventListener("selectionChange", this, true); this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this, false); - this._targets = null; + this._targets = []; // Clean up NJevent("disableStageMove"); @@ -749,7 +756,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { captureSelectionDrawn: { value: function(event){ - this._targets = null; + this._targets = []; var len = this.application.ninja.selectedElements.length; if(len) -- cgit v1.2.3