loleaflet/js/jquery.mCustomScrollbar.js |   27 +++++++++++++++++++--------
 loleaflet/src/control/Control.Scroll.js |    5 ++++-
 2 files changed, 23 insertions(+), 9 deletions(-)

New commits:
commit cff5791f2e410387212feac1305da7763f8ac90d
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Apr 11 13:32:24 2019 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Wed Apr 17 16:28:55 2019 +0200

    Prevent view from jumping on zoom in/out on mobile
    
    Change-Id: I29262d518d61a4a06d66271033c958e56ff16a2b
    Reviewed-on: https://gerrit.libreoffice.org/70592
    Reviewed-by: Tor Lillqvist <t...@collabora.com>
    Tested-by: Tor Lillqvist <t...@collabora.com>
    (cherry picked from commit 42a739a7bc53f9992056de4e00db90a5e613c04c)
    Reviewed-on: https://gerrit.libreoffice.org/70887
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Tested-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/loleaflet/js/jquery.mCustomScrollbar.js 
b/loleaflet/js/jquery.mCustomScrollbar.js
index 9437406d2..14bf9d9a2 100644
--- a/loleaflet/js/jquery.mCustomScrollbar.js
+++ b/loleaflet/js/jquery.mCustomScrollbar.js
@@ -284,6 +284,11 @@ and dependencies (minified).
                                */
                                updateOnContentResize:true,
                                /*
+                               prevent from updating view position after 
content resize to avoid jumping on mobile devices
+                               values: boolean
+                               */
+                               jumpOnContentResize:true,
+                               /*
                                auto-update scrollbars each time each image 
inside the element is fully loaded 
                                values: "auto", boolean
                                */
@@ -561,31 +566,37 @@ and dependencies (minified).
                                                var 
to=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)];
                                                if(o.axis!=="x"){ /* y/yx axis 
*/
                                                        if(!d.overflowed[0]){ 
/* y scrolling is not required */
-                                                               
_resetContentPosition.call(this); /* reset content position */
+                                                               
if(o.advanced.jumpOnContentResize)
+                                                                       
_resetContentPosition.call(this); /* reset content position */
                                                                
if(o.axis==="y"){
                                                                        
_unbindEvents.call(this);
-                                                               }else 
if(o.axis==="yx" && d.overflowed[1]){
+                                                               }else 
if(o.axis==="yx" && d.overflowed[1] && o.advanced.jumpOnContentResize){
                                                                        
_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
                                                                }
-                                                       }else 
if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()){
+                                                       }else 
if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()
+                                                                       && 
o.advanced.jumpOnContentResize){
                                                                
_resetContentPosition.call(this); /* reset content position */
                                                        }else{ /* y scrolling 
is required */
-                                                               
_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
+                                                               
if(o.advanced.jumpOnContentResize)
+                                                                       
_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
                                                                
d.contentReset.y=null;
                                                        }
                                                }
                                                if(o.axis!=="y"){ /* x/yx axis 
*/
                                                        if(!d.overflowed[1]){ 
/* x scrolling is not required */
-                                                               
_resetContentPosition.call(this); /* reset content position */
+                                                               
if(o.advanced.jumpOnContentResize)
+                                                                       
_resetContentPosition.call(this); /* reset content position */
                                                                
if(o.axis==="x"){
                                                                        
_unbindEvents.call(this);
-                                                               }else 
if(o.axis==="yx" && d.overflowed[0]){
+                                                               }else 
if(o.axis==="yx" && d.overflowed[0] && o.advanced.jumpOnContentResize){
                                                                        
_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
                                                                }
                                                        }else 
if(mCSB_dragger[1].width()>mCSB_dragger[1].parent().width()){
-                                                               
_resetContentPosition.call(this); /* reset content position */
+                                                               
if(o.advanced.jumpOnContentResize)
+                                                                       
_resetContentPosition.call(this); /* reset content position */
                                                        }else{ /* x scrolling 
is required */
-                                                               
_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
+                                                               
if(o.advanced.jumpOnContentResize)
+                                                                       
_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
                                                                
d.contentReset.x=null;
                                                        }
                                                }
diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index 829ce18ab..ab3fc47c6 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -31,7 +31,10 @@ L.Control.Scroll = L.Control.extend({
                        axis: 'yx',
                        theme: 'minimal-dark',
                        scrollInertia: 0,
-                       advanced:{autoExpandHorizontalScroll: true}, /* weird 
bug, it should be false */
+                       advanced:{
+                               autoExpandHorizontalScroll: true, /* weird bug, 
it should be false */
+                               jumpOnContentResize: false /* prevent from 
jumping on a mobile devices */
+                       },
                        callbacks:{
                                onScrollStart: function() {
                                        control._map.fire('closepopup');
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to