From 31b094ee21102f99a4021d505bc3a28527c9e23d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 01:33:20 -0700 Subject: Fixing the close document. Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 82c4d652..da5a4f76 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -164,27 +164,23 @@ exports.Stage = Montage.create(Component, { return this._currentDocument; }, set : function(value) { - // TODO: WRONG! Fails when going from design to code view - if (value === this._currentDocument || value.getProperty("currentView") !== "design") { - console.log("Stage - current document not set since the same value of " + this._currentDocument + " and value " + value); + if (value === this._currentDocument) { return; } - if(!this._currentDocument) { + if(!this._currentDocument && value.currentView === "design") { this.showRulers(); this.hideCanvas(false); } this._currentDocument = value; - if(this._currentDocument.currentView === "design") { - this.clearAllCanvas(); - this.initWithDocument(false); - } - if(!value) { this.hideRulers(); this.hideCanvas(true); + } else if(this._currentDocument.currentView === "design") { + this.clearAllCanvas(); + this.initWithDocument(false); } } }, -- cgit v1.2.3