@thi.ng/hiccup-canvas
Version:
Hiccup shape tree renderer for vanilla Canvas 2D contexts
16 lines (15 loc) • 344 B
JavaScript
const __endShape = (ctx, attribs, doFill = true) => {
let v;
if (doFill && (v = attribs.fill) && v !== "none") {
(v = attribs.fillRule) ? ctx.fill(v) : ctx.fill();
}
if ((v = attribs.stroke) && v !== "none") {
ctx.stroke();
}
if (v = attribs.clip) {
ctx.clip(v === true ? "nonzero" : v);
}
};
export {
__endShape
};