loleaflet/src/dom/DomEvent.js |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 6478015ccbf7ee49b026820960edac4401334cd2
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Thu May 30 16:07:59 2019 +0300
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Thu May 30 16:31:42 2019 +0300

    tdf#125389: Guard against exception if e.touches is zero length
    
    For a touchend event, the touches property will be a zero-length
    array. At least in WebKit on iOS or Safari. Work around that. The
    proper fix would probably be to not even call the getMousePosition()
    function for touchend events?
    
    Change-Id: I1c4cdb26b293e551c3c6f51208f73ee5a8044ecb

diff --git a/loleaflet/src/dom/DomEvent.js b/loleaflet/src/dom/DomEvent.js
index 0d59d54aa..f9df070d8 100644
--- a/loleaflet/src/dom/DomEvent.js
+++ b/loleaflet/src/dom/DomEvent.js
@@ -195,10 +195,19 @@ L.DomEvent = {
                        left = top = 0;
                }
 
-               if (e.clientX === undefined && e.touches !== undefined)
+               // When called for a touchend event, at least in WebKit on iOS 
and Safari, the
+               // touches array will be of zero length. Probably it is a 
programming logic error to
+               // even call this function for a touchend event, as by 
definition no finger is
+               // touching the screen any longer then and thus there is no 
"mouse position". But
+               // let's just least guard against an unhandled exception for 
now.
+               if (e.clientX === undefined && e.touches !== undefined && 
e.touches.length > 0)
                        return new L.Point(
                                e.touches[0].clientX - left - 
container.clientLeft,
                                e.touches[0].clientY - top - 
container.clientTop);
+               else if (e.clientX === undefined && e.changedTouches !== 
undefined && e.changedTouches.length > 0)
+                       return new L.Point(
+                               e.changedTouches[0].clientX - left - 
container.clientLeft,
+                               e.changedTouches[0].clientY - top - 
container.clientTop);
 
                return new L.Point(
                        e.clientX - left - container.clientLeft,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to