loleaflet: adjust the map position on resize...

... if there is an active/visible cursor *and* it is out of the visible
map-area. The map position is so adjusted that the cursor will in the
center of the visible map area. This is needed for mobile(at least
android) because of the on-screen keyboard.

Note: We already do this for every 'invalidatecursor' message.
Change-Id: I3342a165ad47fe1b32715f3a6bf35486ba2f287c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100489
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
This commit is contained in:
Dennis Francis 2020-08-11 11:54:48 +05:30
parent 13ba88f739
commit 9305d75362
2 changed files with 12 additions and 0 deletions

View file

@ -80,6 +80,13 @@ L.CalcTileLayer = (L.Browser.mobile ? L.TileLayer : L.CanvasTileLayer).extend({
map.addControl(L.control.columnHeader());
map.addControl(L.control.rowHeader());
L.TileLayer.prototype.onAdd.call(this, map);
map.on('resize', function () {
if (this.isCursorVisible()) {
this._onUpdateCursor(true /* scroll */);
}
}.bind(this));
this._annotations = {};
},

View file

@ -2263,6 +2263,11 @@ L.TileLayer = L.GridLayer.extend({
// Update cursor layer (blinking cursor).
_onUpdateCursor: function (scroll, zoom) {
if (!this._visibleCursor) {
return;
}
var cursorPos = this._visibleCursor.getNorthWest();
var docLayer = this._map._docLayer;