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

New commits:
commit 4e42bae4a73fe8342921f4d695e9c84e723e3f33
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Mon Dec 2 16:43:18 2019 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Mon Dec 2 17:49:12 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>

diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js
index 7855ae11d..5bd4471db 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -44,12 +44,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);
                                }
@@ -58,11 +53,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);
                                }
@@ -150,6 +141,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';
@@ -195,6 +192,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