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

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 30 21:01:30 UTC 2020


 loleaflet/css/spreadsheet-mobile.css  |    4 ++++
 loleaflet/src/control/Control.Tabs.js |   25 +++++++++++++++----------
 2 files changed, 19 insertions(+), 10 deletions(-)

New commits:
commit ad2391ae4649140b6653fa7aeb4fb2ff4986e0d3
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Jan 30 13:19:15 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Thu Jan 30 22:01:08 2020 +0100

    loleaflet: mobile: use Hammer recognizer events instead of 'contextmenu'
    
    Unfortunately the emulate 'context menu' conflict with the default
    horizontal scroll behavior
    
    Change-Id: I3cd45520a6f1e00460031b78e4963db59bc9ae59
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87750
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/css/spreadsheet-mobile.css b/loleaflet/css/spreadsheet-mobile.css
index e73cb506e..c5af29197 100644
--- a/loleaflet/css/spreadsheet-mobile.css
+++ b/loleaflet/css/spreadsheet-mobile.css
@@ -55,9 +55,13 @@
 
 	.spreadsheet-tabs-container {
 		left: 24px;
+	}
+
+	.spreadsheet-tab-scroll {
 		overflow-x: scroll;
 		scrollbar-width: none; /*css draft (firefox only)*/
 		-ms-scrollbar: none; /*ie*/
+		-webkit-overflow-scrolling: touch;
 	}
 
 	.spreadsheet-tabs-container, #spreadsheet-toolbar{
diff --git a/loleaflet/src/control/Control.Tabs.js b/loleaflet/src/control/Control.Tabs.js
index 85d493397..cb291f697 100644
--- a/loleaflet/src/control/Control.Tabs.js
+++ b/loleaflet/src/control/Control.Tabs.js
@@ -3,7 +3,7 @@
  * L.Control.Tabs is used to switch sheets in Calc
  */
 
-/* global $ vex _ _UNO */
+/* global $ vex _ _UNO Hammer */
 L.Control.Tabs = L.Control.extend({
 	onAdd: function(map) {
 		map.on('updatepermission', this._onUpdatePermission, this);
@@ -114,19 +114,24 @@ L.Control.Tabs = L.Control.extend({
 						continue;
 					var id = 'spreadsheet-tab' + i;
 					var tab = L.DomUtil.create('button', 'spreadsheet-tab', ssTabScroll);
-					L.DomEvent.enableLongTap(tab);
 
-					L.DomEvent.on(tab, 'contextmenu', function(j) {
-						return function() {
-							this._tabForContextMenu = j;
-							if (window.mode.isMobile()) {
+					if (window.mode.isMobile()) {
+						(new Hammer(tab, {recognizers: [[Hammer.Press]]}))
+						.on('press', function (j) {
+							return function() {
+								this._tabForContextMenu = j;
 								window.contextMenuWizard = true;
 								if (this._map._permission != 'readonly') this._map.fire('mobilewizard', menuData);
-							} else {
+							};
+						}(i).bind(this));
+					} else {
+						L.DomEvent.on(tab, 'contextmenu', function(j) {
+							return function() {
+								this._tabForContextMenu = j;
 								$('spreadsheet-tab' + j).contextMenu();
-							}
-						};
-					}(i).bind(this));
+							};
+						}(i).bind(this));
+					}
 
 					tab.textContent = e.partNames[i];
 					tab.id = id;


More information about the Libreoffice-commits mailing list