@glideapps/glide-data-grid
Version:
React data grid for beautifully displaying and editing large amounts of data with amazing performance.
35 lines • 1.22 kB
JavaScript
import { degreesToRadians } from "../common/utils.js";
import { GridCellKind } from "../internal/data-grid/data-grid-types.js";
export const protectedCellRenderer = {
getAccessibilityString: () => "",
measure: () => 108,
kind: GridCellKind.Protected,
needsHover: false,
needsHoverPosition: false,
draw: drawProtectedCell,
onPaste: () => undefined,
};
function drawProtectedCell(args) {
const { ctx, theme, rect } = args;
const { x, y, height: h } = rect;
ctx.beginPath();
const radius = 2.5;
let xStart = x + theme.cellHorizontalPadding + radius;
const center = y + h / 2;
const p = Math.cos(degreesToRadians(30)) * radius;
const q = Math.sin(degreesToRadians(30)) * radius;
for (let i = 0; i < 12; i++) {
ctx.moveTo(xStart, center - radius);
ctx.lineTo(xStart, center + radius);
ctx.moveTo(xStart + p, center - q);
ctx.lineTo(xStart - p, center + q);
ctx.moveTo(xStart - p, center - q);
ctx.lineTo(xStart + p, center + q);
xStart += 8;
}
ctx.lineWidth = 1.1;
ctx.lineCap = "square";
ctx.strokeStyle = theme.textLight;
ctx.stroke();
}
//# sourceMappingURL=protected-cell.js.map