Skip to content

Commit

Permalink
refactor(geom-axidraw): update draw command handling
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Mar 18, 2023
1 parent 610f873 commit 18cd5bc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/geom-axidraw/src/as-axidraw.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DrawCommand, UP } from "@thi.ng/axidraw/api";
import type { DrawCommand } from "@thi.ng/axidraw/api";
import { DOWN, MOVE, UP } from "@thi.ng/axidraw/commands.js";
import { polyline } from "@thi.ng/axidraw/polyline";
import type { MultiFn1O } from "@thi.ng/defmulti";
import { defmulti } from "@thi.ng/defmulti/defmulti";
Expand Down Expand Up @@ -138,15 +139,13 @@ function* __points(
function* emitChunk($pts: ReadonlyVec[]): IterableIterator<DrawCommand> {
if (down != undefined) yield ["pen", down];
for (let p of sort ? (<PointOrdering>sort)($pts) : $pts) {
yield* [
["m", p, speed],
["d", delayDown],
["u", delayUp],
];
yield MOVE(p, speed);
yield DOWN(delayDown);
yield UP(delayUp);
}
if (down != undefined) yield ["pen"];
}
yield UP;
yield UP();
if (interleave) {
const { num, commands } = interleave;
if (interleave.start !== false) yield* commands(0);
Expand Down

0 comments on commit 18cd5bc

Please sign in to comment.