diff options
author | Nivesh Rajbhandari | 2012-05-31 16:30:26 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-05-31 16:30:26 -0700 |
commit | 294baf576986adb139406e516d8461070fdfd695 (patch) | |
tree | df77247a00dd3fea711ec25651b4d25e545521e6 /js | |
parent | 4b455d9bb1c3ff7a8199628dc66e158cdee936df (diff) | |
download | ninja-294baf576986adb139406e516d8461070fdfd695.tar.gz |
Fixing scroll offsets when switching between documents.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-x | js/stage/stage.reel/stage.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index fd9db5ec..087606d0 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -179,6 +179,11 @@ exports.Stage = Montage.create(Component, { | |||
179 | this.hideCanvas(false); | 179 | this.hideCanvas(false); |
180 | } | 180 | } |
181 | 181 | ||
182 | if(this.currentDocument && (this.currentDocument.currentView === "design")) { | ||
183 | this.currentDocument.model.scrollLeft = this._scrollLeft; | ||
184 | this.currentDocument.model.scrollTop = this._scrollTop; | ||
185 | } | ||
186 | |||
182 | this._currentDocument = value; | 187 | this._currentDocument = value; |
183 | 188 | ||
184 | if(!value) { | 189 | if(!value) { |
@@ -193,7 +198,7 @@ exports.Stage = Montage.create(Component, { | |||
193 | this.showRulers(); | 198 | this.showRulers(); |
194 | 199 | ||
195 | this.clearAllCanvas(); | 200 | this.clearAllCanvas(); |
196 | this.initWithDocument(false); | 201 | this.initWithDocument(); |
197 | } else { | 202 | } else { |
198 | this.showCodeViewBar(true); | 203 | this.showCodeViewBar(true); |
199 | this.collapseAllPanels(); | 204 | this.collapseAllPanels(); |
@@ -299,8 +304,14 @@ exports.Stage = Montage.create(Component, { | |||
299 | }, | 304 | }, |
300 | 305 | ||
301 | initWithDocument: { | 306 | initWithDocument: { |
302 | value: function(didSwitch) { | 307 | value: function() { |
303 | var designView = this.application.ninja.currentDocument.model.views.design; | 308 | var model = this.currentDocument.model, |
309 | designView = this.currentDocument.model.views.design, | ||
310 | didSwitch = false; | ||
311 | |||
312 | if(model.scrollLeft != null) { | ||
313 | didSwitch = true; | ||
314 | } | ||
304 | 315 | ||
305 | // Recalculate the canvas sizes because of splitter resizing | 316 | // Recalculate the canvas sizes because of splitter resizing |
306 | this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.element.offsetWidth - 11 ; | 317 | this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.element.offsetWidth - 11 ; |
@@ -336,8 +347,8 @@ exports.Stage = Montage.create(Component, { | |||
336 | } | 347 | } |
337 | 348 | ||
338 | if(didSwitch) { | 349 | if(didSwitch) { |
339 | this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft = this.application.ninja.currentDocument.model.scrollLeft; | 350 | this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft = this.currentDocument.model.scrollLeft; |
340 | this.application.ninja.currentDocument.model.views.design.document.body.scrollTop = this.application.ninja.currentDocument.model.scrollTop; | 351 | this.application.ninja.currentDocument.model.views.design.document.body.scrollTop = this.currentDocument.model.scrollTop; |
341 | this.handleScroll(); | 352 | this.handleScroll(); |
342 | } else { | 353 | } else { |
343 | this.centerStage(); | 354 | this.centerStage(); |