diff options
author | Valerio Virgillito | 2012-05-30 01:33:20 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-30 01:33:20 -0700 |
commit | 31b094ee21102f99a4021d505bc3a28527c9e23d (patch) | |
tree | a9525ea312f8cc0d25ab6410394f01e974b69068 /js/stage | |
parent | d8840eda0d3b3e31fb5a72306fe66608f4f99c2b (diff) | |
download | ninja-31b094ee21102f99a4021d505bc3a28527c9e23d.tar.gz |
Fixing the close document.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/stage')
-rwxr-xr-x | js/stage/layout.js | 6 | ||||
-rwxr-xr-x | js/stage/stage-deps.js | 7 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 14 |
3 files changed, 14 insertions, 13 deletions
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, { | |||
33 | return this._currentDocument; | 33 | return this._currentDocument; |
34 | }, | 34 | }, |
35 | set : function(value) { | 35 | set : function(value) { |
36 | if (value === this._currentDocument || value.getProperty("currentView") !== "design") { | 36 | if (value === this._currentDocument) {// || value.getProperty("currentView") !== "design") { |
37 | return; | 37 | return; |
38 | } | 38 | } |
39 | 39 | ||
40 | this._currentDocument = value; | 40 | this._currentDocument = value; |
41 | 41 | ||
42 | if(this._currentDocument) { | 42 | if(!value) { |
43 | |||
44 | } else if(this._currentDocument.currentView === "design") { | ||
43 | this.elementsToDraw = this._currentDocument.model.documentRoot.childNodes; | 45 | this.elementsToDraw = this._currentDocument.model.documentRoot.childNodes; |
44 | } | 46 | } |
45 | } | 47 | } |
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, { | |||
25 | return this._currentDocument; | 25 | return this._currentDocument; |
26 | }, | 26 | }, |
27 | set : function(value) { | 27 | set : function(value) { |
28 | if (value === this._currentDocument || value.getProperty("currentView") !== "design") { | 28 | if (value === this._currentDocument) {// || value.getProperty("currentView") !== "design") { |
29 | return; | 29 | return; |
30 | } | 30 | } |
31 | 31 | ||
32 | this._currentDocument = value; | 32 | this._currentDocument = value; |
33 | 33 | ||
34 | if(this._currentDocument) { | 34 | if(!value) { |
35 | |||
36 | } else if(this._currentDocument.currentView === "design") { | ||
35 | workingPlane = [0,0,1,0]; | 37 | workingPlane = [0,0,1,0]; |
36 | 38 | ||
37 | snapManager._isCacheInvalid = true; | 39 | snapManager._isCacheInvalid = true; |
@@ -39,6 +41,7 @@ exports.StageDeps = Montage.create(Component, { | |||
39 | 41 | ||
40 | drawUtils.initializeFromDocument(); | 42 | drawUtils.initializeFromDocument(); |
41 | } | 43 | } |
44 | |||
42 | } | 45 | } |
43 | }, | 46 | }, |
44 | 47 | ||
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, { | |||
164 | return this._currentDocument; | 164 | return this._currentDocument; |
165 | }, | 165 | }, |
166 | set : function(value) { | 166 | set : function(value) { |
167 | // TODO: WRONG! Fails when going from design to code view | 167 | if (value === this._currentDocument) { |
168 | if (value === this._currentDocument || value.getProperty("currentView") !== "design") { | ||
169 | console.log("Stage - current document not set since the same value of " + this._currentDocument + " and value " + value); | ||
170 | return; | 168 | return; |
171 | } | 169 | } |
172 | 170 | ||
173 | if(!this._currentDocument) { | 171 | if(!this._currentDocument && value.currentView === "design") { |
174 | this.showRulers(); | 172 | this.showRulers(); |
175 | this.hideCanvas(false); | 173 | this.hideCanvas(false); |
176 | } | 174 | } |
177 | 175 | ||
178 | this._currentDocument = value; | 176 | this._currentDocument = value; |
179 | 177 | ||
180 | if(this._currentDocument.currentView === "design") { | ||
181 | this.clearAllCanvas(); | ||
182 | this.initWithDocument(false); | ||
183 | } | ||
184 | |||
185 | if(!value) { | 178 | if(!value) { |
186 | this.hideRulers(); | 179 | this.hideRulers(); |
187 | this.hideCanvas(true); | 180 | this.hideCanvas(true); |
181 | } else if(this._currentDocument.currentView === "design") { | ||
182 | this.clearAllCanvas(); | ||
183 | this.initWithDocument(false); | ||
188 | } | 184 | } |
189 | } | 185 | } |
190 | }, | 186 | }, |