[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/src
Pranav Kant
pranavk at collabora.co.uk
Thu May 11 11:29:35 UTC 2017
loleaflet/src/control/Control.Scroll.js | 16 +++++++++++++++-
loleaflet/src/control/Scroll.js | 1 +
2 files changed, 16 insertions(+), 1 deletion(-)
New commits:
commit 72ec586bb5154b3707807a7b7439f074624633ca
Author: Pranav Kant <pranavk at 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
Reviewed-on: https://gerrit.libreoffice.org/37503
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
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});
},
More information about the Libreoffice-commits
mailing list