UNPKG

handsontable

Version:

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

23 lines 718 B
import { scrollWindowToCell, createScrollTargetCalculator } from "../utils.mjs"; /** * Scroll strategy for non-contiguous selections. * * @param {Core} hot Handsontable instance. * @returns {function(): function(CellCoords): void} */ export function noncontiguousScrollStrategy(hot) { return cellCoords => { const scrollTargetCalc = createScrollTargetCalculator(hot); const targetScroll = { row: scrollTargetCalc.getComputedRowTarget(cellCoords), col: scrollTargetCalc.getComputedColumnTarget(cellCoords) }; hot.scrollViewportTo(targetScroll, () => { const { row, col } = targetScroll; scrollWindowToCell(hot.getCell(row, col, true)); }); }; }