[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Feb 18 12:52:46 UTC 2019
loleaflet/src/layer/tile/TileLayer.js | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
New commits:
commit d8ec4146ff4f365de21e733db07d679e91d9bd74
Author: merttumer <mert.tumer at collabora.com>
AuthorDate: Thu Feb 14 22:01:34 2019 +0300
Commit: Mert Tümer <mert.tumer at collabora.com>
CommitDate: Mon Feb 18 13:52:24 2019 +0100
Fix Typing causes the other view to jump back to its cursor
This bug causes scrolling impossible when multiple users
working on the same document. When one view is typing
the others jump back to their cursors
Change-Id: I8e028fbfcecd2123db8abe57f0ffedd3d35f2b21
Signed-off-by: merttumer <mert.tumer at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/67846
Reviewed-by: Aron Budea <aron.budea at collabora.com>
Tested-by: Aron Budea <aron.budea at collabora.com>
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index e48f0f178..70a5bf376 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -89,6 +89,8 @@ L.TileLayer = L.GridLayer.extend({
this._visibleCursor = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(0, 0));
// Do we have focus - ie. should we render a cursor
this._isFocused = true;
+ // Last cursor position for invalidation
+ this.lastCursorPos = this._visibleCursor.getNorthWest();
// Are we zooming currently ? - if so, no cursor.
this._isZooming = false;
// Cursor is visible or hidden (e.g. for graphic selection).
@@ -792,17 +794,27 @@ L.TileLayer = L.GridLayer.extend({
this._visibleCursor = new L.LatLngBounds(
this._twipsToLatLng(topLeftTwips, this._map.getZoom()),
this._twipsToLatLng(bottomRightTwips, this._map.getZoom()));
+ var cursorPos = this._visibleCursor.getNorthWest();
if ((docLayer._followEditor || docLayer._followUser) && this._map.lastActionByUser) {
this._map._setFollowing(false, null);
}
this._map.lastActionByUser = false;
-
if (!this._map._isFocused && this._map._permission === 'edit') {
// Regain cursor if we had been out of focus and now have input.
this._map.fire('editorgotfocus');
}
- this._onUpdateCursor(this._viewId === modifierViewId);
+ //first time document open, set last cursor position
+ if (this.lastCursorPos.lat === 0 && this.lastCursorPos.lng === 0)
+ this.lastCursorPos = cursorPos;
+
+ var updateCursor = false;
+ if ((this.lastCursorPos.lat !== cursorPos.lat) || (this.lastCursorPos.lng !== cursorPos.lng)) {
+ updateCursor = true;
+ this.lastCursorPos = cursorPos;
+ }
+
+ this._onUpdateCursor(updateCursor && (modifierViewId === this._viewId));
},
_updateEditor: function(textMsg) {
@@ -1616,7 +1628,6 @@ L.TileLayer = L.GridLayer.extend({
center = center.subtract(this._map.getSize().divideBy(2));
center.x = Math.round(center.x < 0 ? 0 : center.x);
center.y = Math.round(center.y < 0 ? 0 : center.y);
-
if (!(this._selectionHandles.start && this._selectionHandles.start.isDragged) &&
!(this._selectionHandles.end && this._selectionHandles.end.isDragged) &&
!(docLayer._followEditor || docLayer._followUser)) {
More information about the Libreoffice-commits
mailing list