Make all pages accessible after zooming

After zooming scrollbar was updated and scroll
position was incorrect what caused first pages
not accessible.

Regression was introduced by:
ffd7151443

Second problem was jumping to the cursor
during zooming. Solution was to not update
the cursors on zooming start.

Change-Id: I0891799b03ed4eccb211ee43eb30e546317a90fc
Reviewed-on: https://gerrit.libreoffice.org/69606
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit f496c1e9c588b382fbdb10ae90a0cd85390274e8)
Reviewed-on: https://gerrit.libreoffice.org/69748
This commit is contained in:
Szymon Kłos 2019-03-23 14:51:27 +01:00
parent 6c94280b9c
commit a0797a7518

View file

@ -1588,14 +1588,12 @@ L.TileLayer = L.GridLayer.extend({
_onZoomStart: function () {
this._isZooming = true;
this._onUpdateCursor();
this.updateAllViewCursors();
},
_onZoomEnd: function () {
this._isZooming = false;
this._onUpdateCursor();
this._onUpdateCursor(null, true);
this.updateAllViewCursors();
},
@ -1619,16 +1617,16 @@ L.TileLayer = L.GridLayer.extend({
},
// Update cursor layer (blinking cursor).
_onUpdateCursor: function (scroll) {
_onUpdateCursor: function (scroll, zoom) {
var cursorPos = this._visibleCursor.getNorthWest();
var docLayer = this._map._docLayer;
if ((scroll !== false) && !this._map.getBounds().contains(this._visibleCursor) && this._isCursorVisible) {
if ((!zoom && scroll !== false) && !this._map.getBounds().contains(this._visibleCursor) && this._isCursorVisible) {
var center = this._map.project(cursorPos);
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) &&
if (!zoom && !(this._selectionHandles.start && this._selectionHandles.start.isDragged) &&
!(this._selectionHandles.end && this._selectionHandles.end.isDragged) &&
!(docLayer._followEditor || docLayer._followUser)) {
this._map.fire('scrollto', {x: center.x, y: center.y, calledFromInvalidateCursorMsg: scroll !== undefined});