UNPKG

@visactor/vtable

Version:

canvas table width high performance

16 lines (14 loc) 1.18 kB
export function getColX(col, table, isRightFrozen) { var _a, _b, _c, _d, _e, _f; if (isRightFrozen) return Math.min(table.tableNoFrameWidth, table.getAllColsWidth()) - table.getColsWidth(col, table.colCount - 1) + (null !== (_b = null === (_a = table.getRightFrozenColsScrollLeft) || void 0 === _a ? void 0 : _a.call(table)) && void 0 !== _b ? _b : 0); const frozenOffset = null !== (_d = null === (_c = table.getFrozenColsOffset) || void 0 === _c ? void 0 : _c.call(table)) && void 0 !== _d ? _d : 0, frozenScrollLeft = null !== (_f = null === (_e = table.getFrozenColsScrollLeft) || void 0 === _e ? void 0 : _e.call(table)) && void 0 !== _f ? _f : 0; let colX = table.getColsWidth(0, col); return col >= table.frozenColCount ? colX -= table.scrollLeft + frozenOffset : colX -= frozenScrollLeft, colX; } export function getRowY(row, table, isBottomFrozen) { if (isBottomFrozen) return Math.min(table.tableNoFrameWidth, table.getAllRowsHeight()) - table.getRowsHeight(row, table.rowCount - 1); let rowY = table.getRowsHeight(0, row); return row >= table.frozenRowCount && (rowY -= table.scrollTop), rowY; } //# sourceMappingURL=util.js.map