UNPKG

handsontable

Version:

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

22 lines 598 B
import { scrollWindowToCell } from "../utils.mjs"; /** * Scroll strategy for changed the focus position of the selection. * * @param {Core} hot Handsontable instance. * @returns {function(): function(CellCoords): void} */ export function focusScrollStrategy(hot) { return cellCoords => { hot.scrollViewportTo(cellCoords.toObject(), () => { const activeRange = hot.getSelectedRangeActive(); if (!activeRange) { return; } const { row, col } = activeRange.highlight; scrollWindowToCell(hot.getCell(row, col, true)); }); }; }