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/layout.js | 6 ++++-- js/stage/stage-deps.js | 7 +++++-- js/stage/stage.reel/stage.js | 14 +++++--------- 3 files changed, 14 insertions(+), 13 deletions(-) (limited to 'js/stage') diff --git a/js/stage/layout.js b/js/stage/layout.js index 8b66150d..284968e4 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -33,13 +33,15 @@ exports.Layout = Montage.create(Component, { return this._currentDocument; }, set : function(value) { - if (value === this._currentDocument || value.getProperty("currentView") !== "design") { + if (value === this._currentDocument) {// || value.getProperty("currentView") !== "design") { return; } this._currentDocument = value; - if(this._currentDocument) { + if(!value) { + + } else if(this._currentDocument.currentView === "design") { this.elementsToDraw = this._currentDocument.model.documentRoot.childNodes; } } diff --git a/js/stage/stage-deps.js b/js/stage/stage-deps.js index 756844fd..f27254f9 100755 --- a/js/stage/stage-deps.js +++ b/js/stage/stage-deps.js @@ -25,13 +25,15 @@ exports.StageDeps = Montage.create(Component, { return this._currentDocument; }, set : function(value) { - if (value === this._currentDocument || value.getProperty("currentView") !== "design") { + if (value === this._currentDocument) {// || value.getProperty("currentView") !== "design") { return; } this._currentDocument = value; - if(this._currentDocument) { + if(!value) { + + } else if(this._currentDocument.currentView === "design") { workingPlane = [0,0,1,0]; snapManager._isCacheInvalid = true; @@ -39,6 +41,7 @@ exports.StageDeps = Montage.create(Component, { drawUtils.initializeFromDocument(); } + } }, 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