From e065244ac75d1d0f25fd5c75cb58e714a13fe16b Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Wed, 14 Mar 2012 08:59:17 -0700 Subject: Squashed commit of the following: merge master into timeline Signed-off-by: Jonathan Duran --- js/controllers/selection-controller.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 75968d4a..c713b6e5 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -48,6 +48,7 @@ exports.SelectionController = Montage.create(Component, { this.eventManager.addEventListener("selectAll", this, false); this.eventManager.addEventListener("deleteSelection", this, false); this.eventManager.addEventListener("switchDocument", this, false); + this.eventManager.addEventListener("closeDocument", this, false); // defaultEventManager.addEventListener( "undo", this, false); // defaultEventManager.addEventListener( "redo", this, false); } @@ -89,17 +90,17 @@ exports.SelectionController = Montage.create(Component, { } }, - handleSwitchDocument: { + handleSwitchDocument: { value: function() { - this._selectedItems = this.application.ninja.selectedElements.slice(0); - if(this._selectedItems.length === 0) { - this._isDocument = true; - } else { - this._isDocument = false; + 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} ); } - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); - - this._selectionContainer = this.application.ninja.currentSelectedContainer; } }, -- cgit v1.2.3