loleaflet/js/jquery.mCustomScrollbar.js |   11 +++++++++--
 loleaflet/src/control/Control.Scroll.js |    3 ++-
 loleaflet/src/layer/tile/TileLayer.js   |    2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit e27ae38bebf4b57aa7563357a188e33d0e1e0be8
Author:     Tor Lillqvist <[email protected]>
AuthorDate: Thu Nov 22 14:15:38 2018 +0200
Commit:     Tor Lillqvist <[email protected]>
CommitDate: Thu Nov 22 14:58:56 2018 +0200

    Fix jumping after touch zooming also for mobile clients of normal Online
    
    Don't check window.ThisIsAMobileApp but instead use a much more
    convoluted test to catch only the cases where we do want the document
    to be scrolled, and ignore the case that causes the irritating
    jumping.
    
    In _onUpdateCursor() in TileLayer.js, we know that the scroll
    parameter is not undefined when and only when _onUpdateCursor() is
    called from _onInvalidateCursorMsg(). We pass that information down to
    the onUpdate callback handler passed to the _tweenTo() function in the
    _scrollTo() function in jquery.mCustomScrollbar.js where it shows up
    as property of the options object.
    
    In that location we also make use of the incidental fact that
    options.timeout==1 only when that code is called from mouse-wheel scrolling.
    
    Quite possibly all this could be done much cleaner.
    
    Change-Id: Iefa257bceb54137f25534ccb6786c1d2e315931c

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index 0a933b063..a0d2d325e 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -1,4 +1,4 @@
-/* -*- js-indent-level: 8; indent-tabs-mode: t -*- */
+/* -*- js-indent-level: 8; indent-tabs-mode: t; fill-column: 120 -*- */
 /*
 == malihu jquery custom scrollbar plugin == 
 Version: 3.1.3 
@@ -2120,7 +2120,14 @@ and dependencies (minified).
                                        }
                                },onUpdate:function(){
                                        if(options.callbacks && 
options.onUpdate){
-                                               if (!window.ThisIsAMobileApp || 
options.drag) {
+                                               // This condition is intended 
to filter out the case when this gets
+                                               // invoked from a touch pinch 
gesture, but let through the cases of
+                                               // scrolling with mouse-wheel 
or touchpad, dragging the scrollbar
+                                               // slider, or implicit 
scrolling because of editing in a previously
+                                               // hidden part of the document 
(for instance when pressing enter on the
+                                               // last visible line). The 
options.timeout==1 is a silly way to detect
+                                               // the mouse-wheel scrolling.
+                                               if(options.drag || 
options.timeout===1 || options.calledFromInvalidateCursorMsg==true){
                                                        /* callbacks: 
whileScrolling */
                                                        
if(_cb("whileScrolling")){_mcs(); o.callbacks.whileScrolling.call(el[0]);}
                                                }
diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index 3f49ec4a0..829ce18ab 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -155,7 +155,7 @@ L.Control.Scroll = L.Control.extend({
 
        _onScrollTo: function (e) {
                // triggered by the document (e.g. search result out of the 
viewing area)
-               $('.scroll-container').mCustomScrollbar('scrollTo', [e.y, e.x]);
+               $('.scroll-container').mCustomScrollbar('scrollTo', [e.y, e.x], 
{calledFromInvalidateCursorMsg: e.calledFromInvalidateCursorMsg});
        },
 
        _onScrollBy: function (e) {
@@ -169,6 +169,7 @@ L.Control.Scroll = L.Control.extend({
                if (e.x < 0) {
                        x = '-=' + Math.abs(e.x);
                }
+               // Note: timeout===1 is checked in my extremely ugly hack in 
jquery.mCustomScrollbar.js.
                $('.scroll-container').mCustomScrollbar('scrollTo', [y, x], { 
timeout: 1 });
        },
 
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 6147276ff..dab81ba49 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1608,7 +1608,7 @@ L.TileLayer = L.GridLayer.extend({
                        if (!(this._selectionHandles.start && 
this._selectionHandles.start.isDragged) &&
                            !(this._selectionHandles.end && 
this._selectionHandles.end.isDragged) &&
                            !(docLayer._followEditor || docLayer._followUser)) {
-                               this._map.fire('scrollto', {x: center.x, y: 
center.y});
+                               this._map.fire('scrollto', {x: center.x, y: 
center.y, calledFromInvalidateCursorMsg: scroll !== undefined});
                        }
                }
 
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to