[Libreoffice-commits] online.git: 2 commits - loleaflet/src

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 6 09:46:23 UTC 2019


 loleaflet/src/control/Control.JSDialogBuilder.js |    6 ++--
 loleaflet/src/control/Control.MobileWizard.js    |   32 ++++++++++++++++++++---
 2 files changed, 32 insertions(+), 6 deletions(-)

New commits:
commit c6c49d52ccd7b6de8d00ec4503ee465879c79e71
Author:     Szymon KÅ‚os <szymon.klos at collabora.com>
AuthorDate: Fri Dec 6 10:45:56 2019 +0100
Commit:     Szymon KÅ‚os <szymon.klos at collabora.com>
CommitDate: Fri Dec 6 10:45:56 2019 +0100

    jsdialog: dont animate while restoring the last path
    
    Change-Id: Ia8fc4c69318a5644b77cfef47f7f540f9ac37026

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index fcdd65f4a..094a1b5fa 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -290,8 +290,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
 		{
 			$(contentDiv).hide();
 			if (builder.wizard) {
-				$(sectionTitle).click(function() {
-					builder.wizard.goLevelDown(contentDiv);
+				$(sectionTitle).click(function(event, data) {
+					builder.wizard.goLevelDown(contentDiv, data);
 					if (contentNode.onshow)
 						contentNode.onshow();
 				});
diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index 2d10e3dd3..592ae718c 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -99,7 +99,9 @@ L.Control.MobileWizard = L.Control.extend({
 		this._currentElementId = elementId;
 	},
 
-	goLevelDown: function(contentToShow) {
+	goLevelDown: function(contentToShow, options) {
+		var animate = (options && options.animate != undefined) ? options.animate : true;
+
 		if (!this._isTabMode || this._currentDepth > 0)
 			this.backButton.removeClass('close-button');
 
@@ -109,11 +111,20 @@ L.Control.MobileWizard = L.Control.extend({
 		}
 
 		var titles = '.ui-header.level-' + this.getCurrentLevel() + '.mobile-wizard';
-		$(titles).hide('slide', { direction: 'left' }, 'fast');
+
+		if (animate)
+			$(titles).hide('slide', { direction: 'left' }, 'fast');
+		else
+			$(titles).hide();
+
 		$(contentToShow).siblings().hide();
 		$('#mobile-wizard.funcwizard div#mobile-wizard-content').removeClass('hideHelpBG');
 		$('#mobile-wizard.funcwizard div#mobile-wizard-content').addClass('showHelpBG');
-		$(contentToShow).show('slide', { direction: 'right' }, 'fast');
+
+		if (animate)
+			$(contentToShow).show('slide', { direction: 'right' }, 'fast');
+		else
+			$(contentToShow).show();
 
 		this._currentDepth++;
 		this._setTitle(contentToShow.title);
@@ -170,7 +181,7 @@ L.Control.MobileWizard = L.Control.extend({
 
 	_goToPath: function(path) {
 		for (var index in path) {
-			$('[title=\'' + path[index] + '\'').prev().click();
+			$('[title=\'' + path[index] + '\'').prev().trigger('click', {animate: false});
 		}
 		this._currentPath = path;
 
commit 49e110306729509f415d5e228e7ea17552f04f32
Author:     Szymon KÅ‚os <szymon.klos at collabora.com>
AuthorDate: Fri Dec 6 10:13:19 2019 +0100
Commit:     Szymon KÅ‚os <szymon.klos at collabora.com>
CommitDate: Fri Dec 6 10:13:19 2019 +0100

    jsdialog: scroll to last used element
    
    Change-Id: I58f88ced08263fb1cad75c60937ba4e90a424bfa

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index e60ec7bb0..fcdd65f4a 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -98,6 +98,8 @@ 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);
+
 		if (objectType == 'toolbutton' && eventType == 'click') {
 			builder.map.sendUnoCommand(data);
 		} else if (object) {
diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index 8837b2f3b..2d10e3dd3 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -15,6 +15,7 @@ L.Control.MobileWizard = L.Control.extend({
 	_mainTitle: '',
 	_isTabMode: false,
 	_currentPath: [],
+	_currentElementId: null,
 
 	initialize: function (options) {
 		L.setOptions(this, options);
@@ -93,6 +94,11 @@ L.Control.MobileWizard = L.Control.extend({
 		this._isTabMode = true;
 	},
 
+	setCurrentFocus: function(elementId) {
+		console.warn(elementId);
+		this._currentElementId = elementId;
+	},
+
 	goLevelDown: function(contentToShow) {
 		if (!this._isTabMode || this._currentDepth > 0)
 			this.backButton.removeClass('close-button');
@@ -167,6 +173,13 @@ L.Control.MobileWizard = L.Control.extend({
 			$('[title=\'' + path[index] + '\'').prev().click();
 		}
 		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) {


More information about the Libreoffice-commits mailing list