leaflet: stoped view jumping when deselecting shapes/images

cause of the problem: if the last position of the cursor
before selecting a complex object is out of view
then the page will scroll to that point.
This happens because scrolling takes place between
deselecting object and cursor position update

Change-Id: I4046cf6728f7da32a4f6d89768e201982023afa9
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91734
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
This commit is contained in:
Pranam Lashkari 2020-04-06 04:58:12 +05:30 committed by Andras Timar
parent 351b231d22
commit aba812fc9f

View file

@ -2140,7 +2140,12 @@ L.TileLayer = L.GridLayer.extend({
var cursorPos = this._visibleCursor.getNorthWest();
var docLayer = this._map._docLayer;
if (!zoom && scroll !== false && !this._map.getBounds().contains(this._visibleCursor) && this._map._isCursorVisible) {
if (!zoom
&& scroll !== false
&& !this._map.getBounds().contains(this._visibleCursor)
&& this._map._isCursorVisible
&& this._map._clip._selectionType === 'text') {
var center = this._map.project(cursorPos);
center = center.subtract(this._map.getSize().divideBy(2));
center.x = Math.round(center.x < 0 ? 0 : center.x);