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 From 9e4ee2470726e3334eb47d904a6f4079d4ed7aef Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 6 Mar 2012 17:01:39 -0800 Subject: IKNINJA-1270: fixed browser crashing when you close a document while playing a video then wait for a while Signed-off-by: Ananya Sen --- js/controllers/selection-controller.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 3f9d8514..49bf42b6 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); } @@ -105,6 +106,18 @@ exports.SelectionController = Montage.create(Component, { } }, + handleCloseDocument:{ + value: function() { + //clear selections if all documents are closed + if(this.application.ninja.documentController._documents.length === 0){ + this._selectedItems.length =0; + this.application.ninja.selectedElements.length =0; + this._isDocument = true; + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + } + } + }, + handleElementAdded: { value: function(event) { this.executeSelectElement(event.detail); -- cgit v1.2.3 From 250420d8c6154172b27fe53aff30e78c227e8a67 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 7 Mar 2012 14:26:37 -0800 Subject: minor fixes Signed-off-by: Ananya Sen --- js/controllers/selection-controller.js | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index eff9c91a..c713b6e5 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -100,20 +100,6 @@ exports.SelectionController = Montage.create(Component, { this._isDocument = false; } NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); - - this._selectionContainer = this.application.ninja.currentSelectedContainer; - } - } - }, - - handleCloseDocument:{ - value: function() { - //clear selections if all documents are closed - if(this.application.ninja.documentController._documents.length === 0){ - this._selectedItems.length =0; - this.application.ninja.selectedElements.length =0; - this._isDocument = true; - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); } } }, -- cgit v1.2.3