@visactor/vtable
Version:
canvas table width high performance
46 lines (45 loc) • 1.19 kB
JavaScript
export function getBorderLine(colWidth, rowHeight, top, right, bottom, left) {
const x = left ? -.5 : 0, y = top ? -.5 : 0, detaWidth = left && right ? 0 : left ? .5 : right ? -.5 : 0, detaHeight = top && bottom ? 0 : top ? .5 : bottom ? -.5 : 0, options = [];
return top && options.push({
x: x,
y: y,
points: [ {
x: 0,
y: 0
}, {
x: colWidth + detaWidth,
y: 0
} ]
}), right && options.push({
x: x,
y: y,
points: [ {
x: colWidth + detaWidth,
y: 0
}, {
x: colWidth + detaWidth,
y: rowHeight + detaHeight
} ]
}), bottom && options.push({
x: x,
y: y,
points: [ {
x: colWidth + detaWidth,
y: rowHeight + detaHeight
}, {
x: 0,
y: rowHeight + detaHeight
} ]
}), left && options.push({
x: x,
y: y,
points: [ {
x: 0,
y: rowHeight + detaHeight
}, {
x: 0,
y: 0
} ]
}), options;
}
//# sourceMappingURL=border-line.js.map