loleaflet/src/control/Ruler.js |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

New commits:
commit e8ee2aa06e654980248e0a7dbb599eb7738f8525
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Mon Dec 2 16:43:18 2019 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Tue Dec 10 08:32:54 2019 +0100

    tdf#128468: Make the margin handles in the ruler work better in the iOS app
    
    There is too much state that isn't necessarily in sync. Get rid of
    some of the coupling.
    
    Instead of turning on the catching of touchstart events in the
    _changeInteractions function, which does not work if you tap the
    make-editable button before the document has been loaded completely,
    start catching them right away after creation, but in the handler, the
    _initiateDrag function, ignore the event if the "map" is not yet
    marked as editable.
    
    Change-Id: Ief7a98e9b6ffa4db9d41f558d1081687032c4bcc
    Reviewed-on: https://gerrit.libreoffice.org/84235
    Reviewed-by: Tor Lillqvist <t...@collabora.com>
    Tested-by: Tor Lillqvist <t...@collabora.com>
    (cherry picked from commit 4e42bae4a73fe8342921f4d695e9c84e723e3f33)
    Reviewed-on: https://gerrit.libreoffice.org/84762
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js
index a67d69421..b0e9103d8 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -45,12 +45,7 @@ L.Control.Ruler = L.Control.extend({
                                this._lMarginDrag.style.cursor = 'e-resize';
                                this._rMarginDrag.style.cursor = 'w-resize';
 
-                               if (window.ThisIsTheiOSApp) {
-                                       this.options.interactive = true;
-                                       L.DomEvent.on(this._rMarginDrag, 
'touchstart', this._initiateDrag, this);
-                                       L.DomEvent.on(this._lMarginDrag, 
'touchstart', this._initiateDrag, this);
-                               }
-                               else {
+                               if (!window.ThisIsTheiOSApp) {
                                        L.DomEvent.on(this._rMarginDrag, 
'mousedown', this._initiateDrag, this);
                                        L.DomEvent.on(this._lMarginDrag, 
'mousedown', this._initiateDrag, this);
                                }
@@ -59,11 +54,7 @@ L.Control.Ruler = L.Control.extend({
                                this._lMarginDrag.style.cursor = 'default';
                                this._rMarginDrag.style.cursor = 'default';
 
-                               if (window.ThisIsTheiOSApp) {
-                                       L.DomEvent.off(this._rMarginDrag, 
'touchstart', this._initiateDrag, this);
-                                       L.DomEvent.off(this._lMarginDrag, 
'touchstart', this._initiateDrag, this);
-                               }
-                               else {
+                               if (!window.ThisIsTheiOSApp) {
                                        L.DomEvent.off(this._rMarginDrag, 
'mousedown', this._initiateDrag, this);
                                        L.DomEvent.off(this._lMarginDrag, 
'mousedown', this._initiateDrag, this);
                                }
@@ -154,6 +145,12 @@ L.Control.Ruler = L.Control.extend({
                        this._rToolTip = L.DomUtil.create('div', rToolTip, 
this._rMarginDrag);
                        this._lMarginDrag.title = leftMarginStr;
                        this._rMarginDrag.title = rightMarginStr;
+
+                       if (window.ThisIsTheiOSApp) {
+                               this.options.interactive = true;
+                               L.DomEvent.on(this._rMarginDrag, 'touchstart', 
this._initiateDrag, this);
+                               L.DomEvent.on(this._lMarginDrag, 'touchstart', 
this._initiateDrag, this);
+                       }
                }
 
                this._lMarginMarker.style.width = 
(DraggableConvertRatio*lMargin) + 'px';
@@ -199,6 +196,9 @@ L.Control.Ruler = L.Control.extend({
                        e.clientX = e.touches[0].clientX;
                }
 
+               if (window.ThisIsTheiOSApp && this._map._permission !== 'edit')
+                       return;
+
                this._map.rulerActive = true;
 
                var dragableElem = e.srcElement || e.target;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to