[Libreoffice-commits] online.git: Branch 'libreoffice-5-4' - loleaflet/src
Marco Cecchetti
marco.cecchetti at collabora.com
Wed Jan 31 16:45:08 UTC 2018
loleaflet/src/layer/tile/TileLayer.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
New commits:
commit 4e92ed56056652c9f654dc649587bd51c92bfc48
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date: Wed Dec 13 18:09:36 2017 +0100
calc: do not scroll to cell cursor when position is not changed
Old behaviour: when a cell cursor message is handled the document is
always scrolled in order to make the cell cursor visible.
New behaviour: as the old one except when the position of the cell
cursor is unchanged: in that case no scroll occurs.
Change-Id: Iee9b8e2d9fc8cb72d0292fb48a20cadeedeb015b
Reviewed-on: https://gerrit.libreoffice.org/46535
Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
Tested-by: Marco Cecchetti <mrcekets at gmail.com>
(cherry picked from commit 9e72b2257b6083c40db8c96bb6d70ba11cdbbe03)
Reviewed-on: https://gerrit.libreoffice.org/49018
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 109569ce..7b549812 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -624,6 +624,13 @@ L.TileLayer = L.GridLayer.extend({
if (!this._prevCellCursor) {
this._prevCellCursor = L.LatLngBounds.createDefault();
}
+ if (!this._cellCursorXY) {
+ this._cellCursorXY = new L.Point(-1, -1);
+ }
+ if (!this._prevCellCursorXY) {
+ this._prevCellCursorXY = new L.Point(-1, -1);
+ }
+
if (textMsg.match('EMPTY')) {
this._cellCursorTwips = new L.Bounds(new L.Point(0, 0), new L.Point(0, 0));
this._cellCursor = L.LatLngBounds.createDefault();
@@ -637,6 +644,7 @@ L.TileLayer = L.GridLayer.extend({
this._cellCursor = new L.LatLngBounds(
this._twipsToLatLng(topLeftTwips, this._map.getZoom()),
this._twipsToLatLng(bottomRightTwips, this._map.getZoom()));
+ this._cellCursorXY = new L.Point(parseInt(strTwips[4]), parseInt(strTwips[5]));
}
var horizontalDirection = 0;
@@ -1588,7 +1596,7 @@ L.TileLayer = L.GridLayer.extend({
_onUpdateCellCursor: function (horizontalDirection, verticalDirection, onPgUpDn) {
if (this._cellCursor && !this._isEmptyRectangle(this._cellCursor)) {
var mapBounds = this._map.getBounds();
- if (!mapBounds.contains(this._cellCursor)) {
+ if (!mapBounds.contains(this._cellCursor) && !this._cellCursorXY.equals(this._prevCellCursorXY)) {
var scrollX = 0, scrollY = 0;
if (onPgUpDn) {
var mapHalfHeight = (mapBounds.getNorth() - mapBounds.getSouth()) / 2;
@@ -1626,6 +1634,7 @@ L.TileLayer = L.GridLayer.extend({
center.y = Math.round(center.y < 0 ? 0 : center.y);
this._map.fire('scrollto', {x: center.x, y: center.y});
}
+ this._prevCellCursorXY = this._cellCursorXY;
}
if (onPgUpDn) {
More information about the Libreoffice-commits
mailing list