sheet-switch: show view area with the cell cursor

Issue fixed
===========
* In a spreadsheet with at least two sheets, on the first sheet, select A1,
* Switch to the second sheet, and select a cell way down, eg. A100, Switch back to the first sheet.
=> The view on the first sheet jumps, and will show a range of cells much lower than the originally shown A1.

Fix description
===============
We already have logic in place to switch view area based on the cell
cursor position. But in L.CanvasTileLayer._updateOnChangePart() it sets
the view area to hardcoded (0, 0) using 'updatescrolloffset',
map.scrollTop(0) and map.scrollLeft(0) which does not update the UI
(which is a different problem).  So when the cursor message for A1
arrives, the view shift logic does not do anything because the view area
is already covering A1 even though the UI area is not.  Removing this
arbitrary "scroll to (0, 0)" code enables the "view shift based on cell
cursor" logic work correctly.

Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: I42e89691338403e60a82b5a535eff50c1c18ea12
(cherry picked from commit 9bc49385ddac7f1dc28b27c4e77539c2e14f4341)
This commit is contained in:
Dennis Francis 2021-10-11 11:51:09 +05:30 committed by Dennis Francis
parent 8dd0b1e2db
commit 974437d810

View file

@ -5915,14 +5915,6 @@ L.CanvasTileLayer = L.Layer.extend({
this._painter.update();
}
}
if (typeof (this._prevSelectedPart) === 'number' &&
this._prevSelectedPart !== this._selectedPart
&& this._docType === 'spreadsheet') {
this._map.fire('updatescrolloffset', { x: 0, y: 0, updateHeaders: false });
this._map.scrollTop(0);
this._map.scrollLeft(0);
}
},
_tileReady: function (coords, err, tile) {