[Libreoffice-commits] online.git: loleaflet/src
Andrzej Hunt
andrzej.hunt at collabora.com
Fri Oct 30 05:56:50 PDT 2015
loleaflet/src/control/Control.Scroll.js | 2 +-
loleaflet/src/dom/Draggable.js | 2 +-
loleaflet/src/layer/tile/TileLayer.js | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)
New commits:
commit a815a96ab2855f57c2c3d663c699570d998ab445
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Fri Oct 30 13:54:49 2015 +0100
loleaflet: fix autoscroll on chrome
DomRect doesn't officially contain x and y, instead we should
use left and top (Firefox's DomRect however does contain these).
diff --git a/loleaflet/src/control/Control.Scroll.js b/loleaflet/src/control/Control.Scroll.js
index a869951..e750e80 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -104,7 +104,7 @@ L.Control.Scroll = L.Control.extend({
}
if (e.pos.x > e.map._size.x - 50) {
vx = 50;
- } else if (e.pos.x < 50 + e.map._container.getBoundingClientRect().x) {
+ } else if (e.pos.x < 50) {
vx = -50;
}
diff --git a/loleaflet/src/dom/Draggable.js b/loleaflet/src/dom/Draggable.js
index 7b65378..3eaafa7 100644
--- a/loleaflet/src/dom/Draggable.js
+++ b/loleaflet/src/dom/Draggable.js
@@ -72,7 +72,7 @@ L.Draggable = L.Evented.extend({
// We don't use this internally, but it is needed for external
// manipulation of the cursor position, e.g. when adjusting
// for scrolling during cursor dragging.
- this.startOffset = this._startPoint.subtract(new L.Point(startBoundingRect.x, startBoundingRect.y));
+ this.startOffset = this._startPoint.subtract(new L.Point(startBoundingRect.left, startBoundingRect.top));
L.DomEvent
.on(document, L.Draggable.MOVE[e.type], this._onMove, this)
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 16271d1..aa0a88b 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -658,8 +658,7 @@ L.TileLayer = L.GridLayer.extend({
// Onscreen position of the cursor, i.e. relative to the browser window
var boundingrect = e.target._icon.getBoundingClientRect();
- var cursorPos = L.point(boundingrect.x - e.target._icon.offsetLeft,
- boundingrect.y - e.target._icon.offsetTop);
+ var cursorPos = L.point(boundingrect.left, boundingrect.top);
var expectedPos = L.point(e.originalEvent.pageX, e.originalEvent.pageY).subtract(e.target.dragging._draggable.startOffset);
@@ -675,9 +674,10 @@ L.TileLayer = L.GridLayer.extend({
e.target.dragging._draggable._updatePosition();
}
- var containerPos = new L.point(expectedPos.x - this._map._container.getBoundingClientRect().x,
- expectedPos.y - this._map._container.getBoundingClientRect().y);
+ var containerPos = new L.point(expectedPos.x - this._map._container.getBoundingClientRect().left,
+ expectedPos.y - this._map._container.getBoundingClientRect().top);
+ containerPos = containerPos.add(e.target.dragging._draggable.startOffset);
this._map.fire('handleautoscroll', { pos: containerPos, map: this._map });
}
if (e.type === 'dragend') {
More information about the Libreoffice-commits
mailing list