diff --git a/cell/view/WorkbookView.js b/cell/view/WorkbookView.js index 6c1d893a47..c7a77ebfe7 100644 --- a/cell/view/WorkbookView.js +++ b/cell/view/WorkbookView.js @@ -1277,21 +1277,41 @@ } }; - WorkbookView.prototype._onScrollY = function(pos, initRowsCount) { - var ws = this.getWorksheet(); - var delta = !this.getSmoothScrolling() ? (asc_round(pos - ws.getFirstVisibleRow(true))) : (pos - ws.getFirstVisibleRowSmoothScroll(true)); - if (delta !== 0) { - ws.scrollVertical(delta, this.cellEditor, initRowsCount); - } - }; + WorkbookView.prototype._onScrollY = function (pos, initRowsCount, bDefaultStep) { + let ws = this.getWorksheet(); + let t = this; + let doScroll = function () { + var delta = !t.getSmoothScrolling() ? (asc_round(pos - ws.getFirstVisibleRow(true))) : (pos - ws.getFirstVisibleRowSmoothScroll(true)); + if (delta !== 0) { + ws.scrollVertical(delta, t.cellEditor, initRowsCount); + } + } + if (bDefaultStep) { + ws.executeScrollDefaultStep(function () { + doScroll(); + }) + } else { + doScroll(); + } + }; - WorkbookView.prototype._onScrollX = function(pos, initColsCount) { - var ws = this.getWorksheet(); - var delta = !this.getSmoothScrolling() ? (asc_round(pos - ws.getFirstVisibleCol(true))) : (pos - ws.getFirstVisibleColSmoothScroll(true)); - if (delta !== 0) { - ws.scrollHorizontal(delta, this.cellEditor, initColsCount); - } - }; + WorkbookView.prototype._onScrollX = function (pos, initColsCount, bDefaultStep) { + let ws = this.getWorksheet(); + let t = this; + let doScroll = function () { + var delta = !t.getSmoothScrolling() ? (asc_round(pos - ws.getFirstVisibleCol(true))) : (pos - ws.getFirstVisibleColSmoothScroll(true)); + if (delta !== 0) { + ws.scrollHorizontal(delta, t.cellEditor, initColsCount); + } + } + if (bDefaultStep) { + ws.executeScrollDefaultStep(function () { + doScroll(); + }) + } else { + doScroll(); + } + }; WorkbookView.prototype._onSetSelection = function(range) { var ws = this.getWorksheet(); diff --git a/cell/view/WorksheetView.js b/cell/view/WorksheetView.js index 8e52a23bdf..920855e20c 100644 --- a/cell/view/WorksheetView.js +++ b/cell/view/WorksheetView.js @@ -10961,6 +10961,18 @@ return this; }; + WorksheetView.prototype.executeScrollDefaultStep = function (callback) { + let oView = this.workbook && this.workbook.controller && this.workbook.controller.settings; + let defaultStep = 10; + let realVScrollPxStep = this.vScrollPxStep; + let realHScrollPxStep = this.hScrollPxStep; + this.vScrollPxStep = oView ? oView.vscrollStep : defaultStep; + this.hScrollPxStep = oView ? oView.hscrollStep : defaultStep; + callback(); + this.vScrollPxStep = realVScrollPxStep; + this.hScrollPxStep = realHScrollPxStep; + }; + // ----- Selection ----- // x,y - абсолютные координаты относительно листа (без учета заголовков) diff --git a/cell/view/mobileTouch.js b/cell/view/mobileTouch.js index 393e8ae4b5..3e870bbe7b 100644 --- a/cell/view/mobileTouch.js +++ b/cell/view/mobileTouch.js @@ -211,7 +211,7 @@ function (window, undefined) needInit = isSmoothScrolling; pos += 1; } - _api._onScrollY(pos, needInit); + _api._onScrollY(pos, needInit, true); } else if ('h' === _scroll.directionLocked) { @@ -220,7 +220,7 @@ function (window, undefined) needInit = isSmoothScrolling; pos += 1; } - _api._onScrollX(pos, needInit); + _api._onScrollX(pos, needInit, true); } else if ('n' === _scroll.directionLocked) { @@ -229,14 +229,14 @@ function (window, undefined) needInit = isSmoothScrolling; pos += 1; } - _api._onScrollY(pos, needInit); + _api._onScrollY(pos, needInit, true); pos = -_scroll.x / _api.controller.settings.vscrollStep; if (-_scroll.x >= -_scroll.maxScrollX) { needInit = isSmoothScrolling; pos += 1; } - _api._onScrollX(pos, needInit); + _api._onScrollX(pos, needInit, true); } }; CMobileDelegateEditorCell.prototype.GetContextMenuType = function()