diff options
Diffstat (limited to 'js/stage/stage.reel/stage.js')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index c7afb95c..e00d2b54 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -155,25 +155,41 @@ exports.Stage = Montage.create(Component, { | |||
155 | set: function(value) { this._userContentBorder = value; } | 155 | set: function(value) { this._userContentBorder = value; } |
156 | }, | 156 | }, |
157 | 157 | ||
158 | _activeDocument : { | 158 | _currentDocument: { |
159 | value : null, | 159 | value : null, |
160 | enumerable : false | 160 | enumerable : false |
161 | }, | 161 | }, |
162 | 162 | ||
163 | activeDocument : { | 163 | currentDocument : { |
164 | get : function() { | 164 | get : function() { |
165 | return this._activeDocument; | 165 | return this._currentDocument; |
166 | }, | 166 | }, |
167 | set : function(document) { | 167 | set : function(value) { |
168 | ///// If the document is null set default stylesheets to null | 168 | // TODO: WRONG! Fails when going from design to code view |
169 | if (value === this._currentDocument || value.getProperty("currentView") !== "design") { | ||
170 | console.log("Stage - current document not set since the same value of " + this._currentDocument + " and value " + value); | ||
171 | return; | ||
172 | } | ||
169 | 173 | ||
170 | if(!document) { | 174 | if(!value) { |
171 | return false; | 175 | // Show the rulers |
176 | this.showRulers(); | ||
177 | // Show the canvas | ||
178 | this.hideCanvas(false); | ||
172 | } | 179 | } |
173 | 180 | ||
174 | ///// setting document via binding | 181 | //console.log("Stage - set current document with value of " + value); |
175 | this._activeDocument = document; | 182 | this._currentDocument = value; |
183 | |||
184 | if(this._currentDocument.currentView === "design") { | ||
185 | this.clearAllCanvas(); | ||
186 | this.initWithDocument(false); | ||
187 | } | ||
176 | 188 | ||
189 | if(!this._currentDocument) { | ||
190 | this.hideRulers(); | ||
191 | this.hideCanvas(true); | ||
192 | } | ||
177 | }, | 193 | }, |
178 | enumerable : false | 194 | enumerable : false |
179 | }, | 195 | }, |
@@ -295,9 +311,6 @@ exports.Stage = Montage.create(Component, { | |||
295 | this._scrollLeft = 0; | 311 | this._scrollLeft = 0; |
296 | this._scrollTop = 0; | 312 | this._scrollTop = 0; |
297 | 313 | ||
298 | this.stageDeps.handleOpenDocument(); | ||
299 | this.layout.handleOpenDocument(); | ||
300 | |||
301 | if(designView._template) { | 314 | if(designView._template) { |
302 | var initialLeft = parseInt((this.canvas.width - designView._template.size.width)/2); | 315 | var initialLeft = parseInt((this.canvas.width - designView._template.size.width)/2); |
303 | var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); | 316 | var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); |