From 66edf78c7e5df11218ef733686965beab05c7c7d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 14:01:00 -0700 Subject: fixing a scrolling issue when multiple documents are switched Signed-off-by: Valerio Virgillito --- js/document/document-html.js | 11 +++++++++-- js/document/models/html.js | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'js/document') diff --git a/js/document/document-html.js b/js/document/document-html.js index 0037c94d..983da966 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -139,7 +139,11 @@ exports.HtmlDocument = Montage.create(Component, { //this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing; // Serialize the current scroll position - // TODO: Implement + this.model.scrollLeft = this.application.ninja.stage._scrollLeft; + this.model.scrollTop = this.application.ninja.stage._scrollTop; + this.model.userContentLeft = this.application.ninja.stage._userContentLeft; + this.model.userContentTop = this.application.ninja.stage._userContentTop; + // Serialize the selection this.model.selection = this.application.ninja.selectedElements.slice(0); @@ -163,7 +167,10 @@ exports.HtmlDocument = Montage.create(Component, { //this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing; // Deserialize the current scroll position - // TODO: Implement + this.application.ninja.stage._scrollLeft = this.model.scrollLeft; + this.application.ninja.stage._scrollTop = this.model.scrollTop; + this.application.ninja.stage._userContentLeft = this.model.userContentLeft; + this.application.ninja.stage._userContentTop = this.model.userContentTop; this.application.ninja.selectedElements = this.model.selection.slice(0); diff --git a/js/document/models/html.js b/js/document/models/html.js index 67457863..a97b4b5a 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js @@ -27,6 +27,23 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { draw3DGrid: { value: false }, + //////////////////////////////////////////////////////////////////// + // + scrollLeft: { + value: null + }, + + scrollTop: { + value: null + }, + + userContentLeft: { + value: null + }, + + userContentTop: { + value: null + }, //////////////////////////////////////////////////////////////////// // baseHref: { -- cgit v1.2.3