From: Aleksander Ɓukasz Date: Tue, 18 Jun 2013 10:28:14 +0000 (+0200) Subject: documentCanvas: restoring scrollbar position on displaying canvas again X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/fb606ab5c798838e28398f2a3fb45d29ae2dbc5f documentCanvas: restoring scrollbar position on displaying canvas again --- diff --git a/modules/documentCanvas/documentCanvas.js b/modules/documentCanvas/documentCanvas.js index f8c21ed..bb8ad4a 100644 --- a/modules/documentCanvas/documentCanvas.js +++ b/modules/documentCanvas/documentCanvas.js @@ -14,6 +14,7 @@ return function(sandbox) { node: $(_.template(template)()), currentNode: null, shownAlready: false, + scrollbarPosition: 0, setup: function() { var view = this; @@ -58,8 +59,12 @@ return function(sandbox) { view.selectFirstNode(); } else if(view.currentNode) { view.movecaretToNode(view.getNodeElement(view.currentNode)); + view.node.find('#rng-module-documentCanvas-contentWrapper').scrollTop(view.scrollbarPosition); } }; + this.node.onHide = function() { + view.scrollbarPosition = view.node.find('#rng-module-documentCanvas-contentWrapper').scrollTop(); + } this.gridToggled = false; },