[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - loleaflet/src

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Mar 27 10:13:15 UTC 2019


 loleaflet/src/control/Control.LokDialog.js |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 0a5032e64cb63a4a2ddeef2bbdfb096369b3f172
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Mar 27 11:26:57 2019 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Mar 27 12:10:06 2019 +0200

    Make tapping an element in a combo box actually work (on touch devices)
    
    If we get a 'touchend' immediately after a 'touchstart', simulate a
    'mousedown' immediately followed by a 'mouseup'.
    
    Change-Id: Ib20eae4cc23518e34a1d948f8e498f50046f72d7

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 7ad6ccade..1836bf7a2 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -10,6 +10,7 @@ L.WinUtil = {
 
 var firstTouchPositionX = null;
 var firstTouchPositionY = null;
+var previousTouchType = null;
 
 function updateTransformation(target) {
 	if (target !== null && target !== undefined) {
@@ -688,6 +689,11 @@ L.Control.LokDialog = L.Control.extend({
 			else if (e.type === 'touchend')
 			{
 				this._postWindowGestureEvent(childId, 'panEnd', firstTouchPositionX, firstTouchPositionY, firstTouchPositionY - touchY);
+				if (previousTouchType === 'touchstart') {
+					// Simulate mouse click
+					this._postWindowMouseEvent('buttondown', childId, firstTouchPositionX, firstTouchPositionY, 1, this._map['mouse'].LOButtons.left, 0);
+					this._postWindowMouseEvent('buttonup', childId, firstTouchPositionX, firstTouchPositionY, 1, this._map['mouse'].LOButtons.left, 0);
+				}
 				firstTouchPositionX = null;
 				firstTouchPositionY = null;
 
@@ -696,6 +702,7 @@ L.Control.LokDialog = L.Control.extend({
 			{
 				this._postWindowGestureEvent(childId, 'panUpdate', firstTouchPositionX, firstTouchPositionY, firstTouchPositionY - touchY);
 			}
+			previousTouchType = e.type;
 		}, this);
 
 		L.DomEvent.on(canvas, 'mousedown mouseup', function(e) {


More information about the Libreoffice-commits mailing list