From 2364c671ffc2953e3ee8dfdf037244de8fab3920 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 6 Mar 2012 16:30:33 -0800 Subject: IKNINJA-1238 fix and fixing other js errors on switching and closing documents Signed-off-by: Ananya Sen --- js/controllers/selection-controller.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 08eb018f..3f9d8514 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -91,15 +91,17 @@ exports.SelectionController = Montage.create(Component, { handleSwitchDocument: { value: function() { - this._selectedItems = this.application.ninja.selectedElements.slice(0); - if(this._selectedItems.length === 0 ){ - this._isDocument = true; - }else{ - this._isDocument = false; - } - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + if(this.application.ninja.documentController.activeDocument.currentView === "design"){ + this._selectedItems = this.application.ninja.selectedElements.slice(0); + if(this._selectedItems.length === 0 ){ + this._isDocument = true; + }else{ + this._isDocument = false; + } + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); - this._selectionContainer = this.application.ninja.currentSelectedContainer; + this._selectionContainer = this.application.ninja.currentSelectedContainer; + } } }, -- cgit v1.2.3