aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-23 13:27:14 -0700
committerValerio Virgillito2012-05-23 13:27:14 -0700
commit108764dbdaa0c040de9146c2d722b6e53830cd54 (patch)
tree372a0e13478ee129c006160399defbdcd38ff619
parent56b03609ada81b270f870d1bb0727ef146cb62e8 (diff)
downloadninja-108764dbdaa0c040de9146c2d722b6e53830cd54.tar.gz
improve the closing of documents.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rwxr-xr-xjs/controllers/document-controller.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 7758f346..dadfaf05 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -393,14 +393,20 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
393 393
394 onCloseFile: { 394 onCloseFile: {
395 value: function(doc) { 395 value: function(doc) {
396 var previousFocusedDocument;
396 397
397 this._documents.splice(this._documents.indexOf(doc), 1); 398 this._documents.splice(this._documents.indexOf(doc), 1);
398 399
399 this._activeDocument = null; 400 if(this._documents.length > 0) {
400 401 previousFocusedDocument = this._documents[this._documents.length - 1];
401 this.application.ninja.stage.hideRulers(); 402 this._activeDocument = previousFocusedDocument;
403 this.switchDocuments(this.activeDocument, previousFocusedDocument, true);
404 } else {
405 this._activeDocument = null;
406 this.application.ninja.stage.hideRulers();
402 407
403 this.application.ninja.stage.hideCanvas(true); 408 this.application.ninja.stage.hideCanvas(true);
409 }
404 410
405 //TODO: Use references for those instead of calling getElementById 411 //TODO: Use references for those instead of calling getElementById
406 if(this._documents.length === 0){ 412 if(this._documents.length === 0){