[Libreoffice-commits] online.git: loleaflet/src
Pranav Kant
pranavk at collabora.co.uk
Wed Apr 12 11:54:16 UTC 2017
loleaflet/src/map/Map.js | 4 ----
1 file changed, 4 deletions(-)
New commits:
commit 336ac4d6d1f41232fb315e76db9e831f421ea5f0
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed Apr 12 16:33:51 2017 +0530
loleaflet: Grid/selection/caret is sometimes displaced
This is actually not a displaced cursor, but displaced tiles map pane.
It happens when the user refreshes the the document page and
before the document finishes loading, switches to some other tab and
then get back to the document when the document load finishes. In such
circumstances, due to browsers not emitting the 'resize' event (probably
because it didn't have the focus when the map loaded) we return
incorrect/unexpected map center. Because 'resize' event sets this._initialCenter to
null, so map.getCenter() never returns this._initialCenter and instead
return this.layerPointToLatLng(this._getCenterLayerPoint()) which seems
to be the correct thing to return here.
The reason that the displaced cursor is not
observed when user doesn't switch to other tabs is because of the
browsers emitting the 'resize' event before we set the map transforms.
Nevertheless, in some circumstances it is quite possible that this
event, 'resize', is processed after we set the transforms even though
user hasn't switched the tabs but probability of this is very less which
justifies this bug's hard-to-reproduce nature when user doesn't change
the tabs.
Instead of making sure that 'resize' event is triggered before we set
the transforms, removing this block of code that returns unexpected
return value (which we never seem to use anywhere anyhow) seems more
sensible thing to do.
Change-Id: Iff532a902e6100be7f39c204cbf2f28f1a7f6a49
Reviewed-on: https://gerrit.libreoffice.org/36458
Reviewed-by: pranavk <pranavk at collabora.co.uk>
Tested-by: pranavk <pranavk at collabora.co.uk>
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 4b7e2c39..fcb75e27 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -427,10 +427,6 @@ L.Map = L.Evented.extend({
getCenter: function () { // (Boolean) -> LatLng
this._checkIfLoaded();
-
- if (this._initialCenter && !this._moved()) {
- return this._initialCenter;
- }
return this.layerPointToLatLng(this._getCenterLayerPoint());
},
More information about the Libreoffice-commits
mailing list