@visactor/vtable
Version:
canvas table width high performance
22 lines (18 loc) • 1.34 kB
JavaScript
;
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;
}
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;
}
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.getRowY = exports.getColX = void 0, exports.getColX = getColX, exports.getRowY = getRowY;
//# sourceMappingURL=util.js.map