loleaflet/src/control/Control.JSDialogBuilder.js | 2 - loleaflet/src/control/Control.MobileWizard.js | 24 +++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-)
New commits: commit d4ca657470d0f49fda9ac8adf4ac850a636d61f0 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Dec 6 11:49:54 2019 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri Dec 6 11:50:03 2019 +0100 jsdialog: scroll to the last seen position Change-Id: I13beffad08521fc8606631ea780bf2d37bd1923b diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index 094a1b5fa..2c4183a13 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -98,7 +98,7 @@ L.Control.JSDialogBuilder = L.Control.extend({ _defaultCallbackHandler: function(objectType, eventType, object, data, builder) { console.debug('control: \'' + objectType + '\' id:\'' + object.id + '\' event: \'' + eventType + '\' state: \'' + data + '\''); - builder.wizard.setCurrentFocus(object.id); + builder.wizard.setCurrentScrollPosition(); if (objectType == 'toolbutton' && eventType == 'click') { builder.map.sendUnoCommand(data); diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js index 592ae718c..5c5493ab3 100644 --- a/loleaflet/src/control/Control.MobileWizard.js +++ b/loleaflet/src/control/Control.MobileWizard.js @@ -15,7 +15,7 @@ L.Control.MobileWizard = L.Control.extend({ _mainTitle: '', _isTabMode: false, _currentPath: [], - _currentElementId: null, + _currentScrollPosition: 0, initialize: function (options) { L.setOptions(this, options); @@ -94,9 +94,8 @@ L.Control.MobileWizard = L.Control.extend({ this._isTabMode = true; }, - setCurrentFocus: function(elementId) { - console.warn(elementId); - this._currentElementId = elementId; + setCurrentScrollPosition: function() { + this._currentScrollPosition = $('#mobile-wizard-content').scrollTop(); }, goLevelDown: function(contentToShow, options) { @@ -179,18 +178,17 @@ L.Control.MobileWizard = L.Control.extend({ right.text(title); }, + _scrollToLastPosition: function() { + if (this._currentScrollPosition) { + $('#mobile-wizard-content').animate({ scrollTop: this._currentScrollPosition }, 0); + } + }, + _goToPath: function(path) { for (var index in path) { $('[title=\'' + path[index] + '\'').prev().trigger('click', {animate: false}); } this._currentPath = path; - - if (this._currentElementId) { - console.warn('scroll to ' + this._currentElementId); - $('#mobile-wizard-content').animate({ - scrollTop: ($(('#' + this._currentElementId)).offset().top) - },0); - } }, _onMobileWizard: function(data) { @@ -235,8 +233,10 @@ L.Control.MobileWizard = L.Control.extend({ $('#mobile-wizard').css('top', ''); } - if (this._isActive && currentPath.length) + if (this._isActive && currentPath.length) { this._goToPath(currentPath); + this._scrollToLastPosition(); + } } }, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits