This commit is contained in:
zenoamaro committed 2019-07-01 02:22:54 +02:00
1 parent 3c5dd97641
commit 27fa1d31c2
3 files changed
+139 -4

No files matched your search

+11 -1
View File
@@ -53,10 +53,20 @@ export function drawLine(ctx, x1, y1, x2, y2, color, plotFn=plot) {
export function drawLineVirtual(x1, y1, x2, y2, color) {
const points = [];
drawLine(null, x1, y1, x2, y2, color, (ctx, x, y, c) => points.push({x, y, c}));
drawLine(
null, x1, y1, x2, y2, color,
(ctx, x, y, c) => points.push({x, y, c})
);
return points;
}
export function checkLineWith(x1, y1, x2, y2, fn) {
drawLine(
null, x1, y1, x2, y2, null,
(ctx, x, y, c) => fn(x, y)
);
}
export function drawRect(ctx, x, y, w, h, color) {
x = Math.round(x); y = Math.round(y);
w = Math.round(w); h = Math.round(h);