UNPKG

handsontable

Version:

Handsontable is a JavaScript Data Grid available for React, Angular and Vue.

26 lines (25 loc) 679 B
"use strict"; exports.__esModule = true; exports.focusScrollStrategy = focusScrollStrategy; var _utils = require("../utils"); /** * Scroll strategy for changed the focus position of the selection. * * @param {Core} hot Handsontable instance. * @returns {function(): function(CellCoords): void} */ function focusScrollStrategy(hot) { return cellCoords => { hot.scrollViewportTo(cellCoords.toObject(), () => { const activeRange = hot.getSelectedRangeActive(); if (!activeRange) { return; } const { row, col } = activeRange.highlight; (0, _utils.scrollWindowToCell)(hot.getCell(row, col, true)); }); }; }