Skip to content

Commit 6bcdf79

Browse files
gokaysatirtimar
authored andcommitted
Calc: Use scrollTo instead of scroll when moving to a certain position.
It prevents from possible accumulated moveBy. Signed-off-by: Gökay Şatır <gokaysatir@gmail.com> Change-Id: Ic4490776e5ab623fb4e7bc5c5c37b3727ca22efb
1 parent 0e4b6ec commit 6bcdf79

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

browser/src/layer/tile/CalcTileLayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ L.CalcTileLayer = L.CanvasTileLayer.extend({
11951195
},
11961196

11971197
_calculateScrollForNewCellCursor: function () {
1198-
var scroll = new app.definitions.simplePoint(0, 0);
1198+
var scroll = new cool.SimplePoint(0, 0);
11991199

12001200
if (!app.calc.cellCursorVisible) {
12011201
return scroll;

browser/src/layer/tile/CanvasTileLayer.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3162,8 +3162,11 @@ L.CanvasTileLayer = L.Layer.extend({
31623162
if (scrollToCursor &&
31633163
!this._map.calcInputBarHasFocus()) {
31643164
const scroll = this._calculateScrollForNewCellCursor();
3165-
if (scroll.x !== 0 || scroll.y !== 0)
3166-
app.activeDocument.activeView.scroll(scroll.pX, scroll.pY);
3165+
if (scroll.x !== 0 || scroll.y !== 0) {
3166+
scroll.x += app.activeDocument.activeView.viewedRectangle.x1;
3167+
scroll.y += app.activeDocument.activeView.viewedRectangle.y1;
3168+
app.activeDocument.activeView.scrollTo(scroll.pX, scroll.pY);
3169+
}
31673170

31683171
this._prevCellCursorAddress = app.calc.cellAddress.clone();
31693172
}

0 commit comments

Comments
 (0)