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

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 31 16:12:15 UTC 2019


 loleaflet/src/control/Control.MobileWizard.js |   11 ++++++++---
 loleaflet/src/control/Control.PartsPreview.js |    5 ++++-
 loleaflet/src/layer/tile/ImpressTileLayer.js  |   13 ++++++++++++-
 3 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit 253d72e09a0bb4e5b01d5012c46af02174cfc616
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Wed Oct 30 13:27:16 2019 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Thu Oct 31 17:12:07 2019 +0100

    loleaflet: mobile: slide preview remains on top of wizard container
    
    Create a new instance of the class "L.Control.PartsPreview" and append
    the contents as a header on the mobile wizard container.
    
    Change-Id: Ieb7bfd920087ebc06e4127f26cfc59cf1b2c70b2
    Reviewed-on: https://gerrit.libreoffice.org/81795
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index ba2a2e87b..3c7bb2659 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -37,6 +37,7 @@ L.ImpressTileLayer = L.TileLayer.extend({
 	},
 
 	beforeAdd: function (map) {
+		map.addControl(L.control.partsPreview());
 		map.on('zoomend', this._onAnnotationZoom, this);
 		map.on('updateparts', this.onUpdateParts, this);
 		map.on('updatepermission', this.onUpdatePermission, this);
@@ -48,6 +49,12 @@ L.ImpressTileLayer = L.TileLayer.extend({
 		map.on('resize', this.onResize, this);
 		if (window.mode.isMobile()) {
 			map.on('doclayerinit', this.onMobileInit, this);
+			L.Control.MobileWizard.mergeOptions({maxHeight: '55%'});
+			var mobileWizard = L.DomUtil.get('mobile-wizard');
+			var container = L.DomUtil.createWithId('div', 'mobile-wizard-header', mobileWizard);
+			var preview = L.DomUtil.createWithId('div', 'mobile-slide-sorter', container);
+			L.DomUtil.toBack(container);
+			map.addControl(L.control.partsPreview(container, preview, {fetchThumbnail: false}));
 		}
 	},
 
@@ -275,7 +282,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
 	},
 
 	onAdd: function (map) {
-		map.addControl(L.control.partsPreview());
 		L.TileLayer.prototype.onAdd.call(this, map);
 		this._annotations = {};
 		this._topAnnotation = [];
@@ -359,6 +365,11 @@ L.ImpressTileLayer = L.TileLayer.extend({
 		this.onAnnotationCancel();
 	},
 
+	_openMobileWizard: function(data) {
+		L.TileLayer.prototype._openMobileWizard.call(this, data);
+		$('mobile-slide-sorter').mCustomScrollbar('update');
+	},
+
 	onReplyClick: function (e) {
 		var comment = {
 			Id: {
commit bbf31520fadae9eff191155ee91007c8f1f732a9
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Oct 31 11:42:10 2019 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Thu Oct 31 17:11:52 2019 +0100

    loleaflet: mobile: avoid fetches thumbnail preview when second instance
    
    is created
    
    This is a small optimization, the first instance will fetch the
    thumbnail preview, then the second instance, will be a listener only
    when it is created.
    
    Change-Id: I883d4260a5ab3dc6dc7d0388969623b9af762fb8
    Reviewed-on: https://gerrit.libreoffice.org/81857
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index fa476ef3b..237a16931 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -6,6 +6,7 @@
 /* global $ */
 L.Control.PartsPreview = L.Control.extend({
 	options: {
+		fetchThumbnail: true,
 		autoUpdate: true,
 		maxWidth: window.mode.isMobile() ? 60 : 180,
 		maxHeight: window.mode.isMobile() ? 60 : 180
@@ -190,7 +191,9 @@ L.Control.PartsPreview = L.Control.extend({
 		var imgSize;
 		if (i === 0 || (previewFrameTop >= topBound && previewFrameTop <= bottomBound)
 			|| (previewFrameBottom >= topBound && previewFrameBottom <= bottomBound)) {
-			imgSize = this._map.getPreview(i, i, this.options.maxWidth, this.options.maxHeight, {autoUpdate: this.options.autoUpdate});
+			imgSize = this.options.fetchThumbnail ?
+				this._map.getPreview(i, i, this.options.maxWidth, this.options.maxHeight, {autoUpdate: this.options.autoUpdate}) :
+				{ width: this.options.maxWidth, height: this.options.maxHeight };
 			img.fetched = true;
 
 			if (this._direction === 'x') {
commit 97573d57c23bdf13b5473ddcd593140ad06eff57
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Wed Oct 30 13:20:14 2019 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Thu Oct 31 17:11:32 2019 +0100

    mobileWizard: set a new "maxHeight" option
    
    Add a new option to the class L.Control.MobileWizard with the
    purpose to define a maximum height of the mobile wizard container.
    
    Change-Id: I7af5f4d087d10442b281002b57c9d0f43c4385e5
    Reviewed-on: https://gerrit.libreoffice.org/81794
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index fd93b9117..8622eb08a 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -5,6 +5,9 @@
 
 /* global $ w2ui _ */
 L.Control.MobileWizard = L.Control.extend({
+	options: {
+		maxHeight: '45%'
+	},
 
 	_inMainMenu: true,
 	_isActive: false,
@@ -13,6 +16,10 @@ L.Control.MobileWizard = L.Control.extend({
 	_isTabMode: false,
 	_currentPath: [],
 
+	initialize: function (options) {
+		L.setOptions(this, options);
+	},
+
 	onAdd: function (map) {
 		this.map = map;
 		map.on('mobilewizard', this._onMobileWizard, this);
@@ -178,7 +185,7 @@ L.Control.MobileWizard = L.Control.extend({
 				else
 					$('#mobile-wizard').css('top', $('#document-container').css('top'));
 			} else {
-				$('#mobile-wizard').height('45%');
+				$('#mobile-wizard').height(this.options.maxHeight);
 				$('#mobile-wizard').css('top', '');
 			}
 
commit bea95e329b17ea4365453c63ee88cf81bf54585e
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Wed Oct 30 13:16:26 2019 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Thu Oct 31 17:11:16 2019 +0100

    mobileWizard: avoid setting the CSS top property
    
    It is better that browser sets the normal CSS Box layout, otherwise I
    have to count pixel for a new box added to the mobile wizard container.
    
    Change-Id: Iec378cfc630be5f8e2419ee22ae074704a9ebc82
    Reviewed-on: https://gerrit.libreoffice.org/81793
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index eb859170a..fd93b9117 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -30,7 +30,6 @@ L.Control.MobileWizard = L.Control.extend({
 		$('#mobile-wizard-tabs').hide();
 		$('#mobile-wizard-titlebar').show();
 		$('#mobile-wizard-titlebar').css('top', '0px');
-		$('#mobile-wizard-content').css('top', '48px');
 		$('#mobile-wizard').removeClass('menuwizard');
 		this._isTabMode = false;
 		this._currentPath = [];
@@ -77,7 +76,6 @@ L.Control.MobileWizard = L.Control.extend({
 		$('#mobile-wizard-tabs').empty();
 		$('#mobile-wizard-tabs').append(tabs);
 		$('#mobile-wizard-titlebar').hide();
-		$('#mobile-wizard-content').css('top', '63px');
 		this._isTabMode = true;
 	},
 


More information about the Libreoffice-commits mailing list