loleaflet/src/control/Ruler.js |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 73a62f189855a2e502fbeff716b6745bbd3f0cbb
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed May 6 09:32:18 2020 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed May 6 13:05:17 2020 +0200

    ruler: workaround adding a tab-stop on mobile
    
    On mobile, don't show a menu, but add the tab-stop immediately
    when long-press event is sent.
    
    Change-Id: Iedd019a40a891d57467d333239b9cb79317cda2d
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93547
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js
index 7d41d7e66..3c849aaad 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -533,17 +533,21 @@ L.Control.Ruler = L.Control.extend({
        _onTabstopContainerLongPress: function(event) {
                var pointX = event.center.x - 
event.target.getBoundingClientRect().left;
                this.currentPositionInTwips = 
this._map._docLayer._pixelsToTwips({x: pointX, y:0}).x;
-
-               $.contextMenu({
-                       selector: '.loleaflet-ruler-tabstopcontainer',
-                       className: 'loleaflet-font',
-                       items: {
-                               inserttabstop: {
-                                       name: _('Insert tabstop'),
-                                       callback: 
(this._insertTabstop).bind(this)
+               if (window.mode.isMobile() || window.mode.isTablet()) {
+                       this._insertTabstop();
+               }
+               else {
+                       $.contextMenu({
+                               selector: '.loleaflet-ruler-tabstopcontainer',
+                               className: 'loleaflet-font',
+                               items: {
+                                       inserttabstop: {
+                                               name: _('Insert tabstop'),
+                                               callback: 
(this._insertTabstop).bind(this)
+                                       }
                                }
-                       }
-               });
+                       });
+               }
        },
 
        _insertTabstop: function() {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to