loleaflet/src/control/Control.Scroll.js |   16 +++++++++++++++-
 loleaflet/src/control/Scroll.js         |    1 +
 2 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 4e8a8d6aad92cb53afe6e253670bb9f05355b3aa
Author: Pranav Kant <pran...@collabora.co.uk>
Date:   Mon May 8 22:16:00 2017 +0530

    loleaflet: Stop ignoring on scrollEnd only; call map.scrollTop to sync
    
    Change-Id: Ic126b60a121cc6959b31ef5533a85e902d58c141

diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index fe533405..3bbb5c5c 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -37,6 +37,9 @@ L.Control.Scroll = L.Control.extend({
                                whileScrolling: function() {
                                        control._onScroll(this);
                                },
+                               onUpdate: function() {
+                                       console.debug('mCustomScrollbar: 
onUpdate:');
+                               },
                                alwaysTriggerOffsets: false
                        }
                });
@@ -89,14 +92,16 @@ L.Control.Scroll = L.Control.extend({
                        return;
                }
 
+               console.debug('_onScroll: ');
                if (!this._map._enabled) {
                        return;
                }
 
                if (this._ignoreScroll) {
-                       this._ignoreScroll = null;
+                       console.debug('_onScroll: ignoring scroll');
                        return;
                }
+
                var offset = new L.Point(
                        -e.mcs.left - this._prevScrollX,
                        -e.mcs.top - this._prevScrollY);
@@ -104,6 +109,7 @@ L.Control.Scroll = L.Control.extend({
                if (!offset.equals(new L.Point(0, 0))) {
                        this._prevScrollY = -e.mcs.top;
                        this._prevScrollX = -e.mcs.left;
+                       console.debug('_onScroll: scrolling: ' + offset);
                        this._map.scroll(offset.x, offset.y);
                        this._map.fire('scrolloffset', offset);
                }
@@ -114,6 +120,13 @@ L.Control.Scroll = L.Control.extend({
                if (this._map._docLayer._docType === 'spreadsheet') {
                        return;
                }
+
+               console.debug('_onScrollEnd:');
+               if (this._ignoreScroll) {
+                       this._ignoreScroll = null;
+                       console.debug('_onScrollEnd: scrollTop: ' + -e.mcs.top);
+                       this._map.scrollTop(-e.mcs.top);
+               }
                this._prevScrollY = -e.mcs.top;
                this._prevScrollX = -e.mcs.left;
                // Scrolling quickly via mousewheel messes up the annotations 
for some reason
@@ -186,6 +199,7 @@ L.Control.Scroll = L.Control.extend({
 
                // for writer documents, ignore scroll while document size is 
being reduced
                if (this._map.getDocType() === 'text' && newDocHeight < 
this._prevDocHeight) {
+                       console.debug('_onUpdateSize: Ignore the scroll !');
                        this._ignoreScroll = true;
                }
                L.DomUtil.setStyle(this._mockDoc, 'width', e.x + 'px');
diff --git a/loleaflet/src/control/Scroll.js b/loleaflet/src/control/Scroll.js
index cc980ae0..9bdcd15c 100644
--- a/loleaflet/src/control/Scroll.js
+++ b/loleaflet/src/control/Scroll.js
@@ -30,6 +30,7 @@ L.Map.include({
        scrollTop: function (y, options) {
                this._setUpdateOffsetEvt(options);
                var offset = this.scrollOffset();
+               console.debug('scrollTop: ' + y + ' ' + offset.y + ' ' + (y - 
offset.y));
                this.panBy(new L.Point(0, y - offset.y), {animate: false});
        },
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to