Skip to content

Commit 64a18b7

Browse files
refactor(geom-axidraw): internal update (polyline conversion)
1 parent 0616b96 commit 64a18b7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/geom-axidraw/src/as-axidraw.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { __sampleAttribs } from "@thi.ng/geom/internal/vertices";
1515
import { withAttribs } from "@thi.ng/geom/with-attribs";
1616
import { concat } from "@thi.ng/transducers/concat";
1717
import { map } from "@thi.ng/transducers/map";
18+
import { mapcat } from "@thi.ng/transducers/mapcat";
1819
import { takeNth } from "@thi.ng/transducers/take-nth";
1920
import type { ReadonlyVec } from "@thi.ng/vectors";
2021
import type {
@@ -92,10 +93,9 @@ export const asAxiDraw: MultiFn1O<
9293

9394
// used for all shapes which need to be sampled
9495
circle: ($, opts) =>
95-
__polyline(
96-
asPolyline(applyTransforms($), opts?.samples).points,
97-
$.attribs,
98-
opts
96+
mapcat(
97+
(line) => __polyline(line.points, $.attribs, opts),
98+
asPolyline(applyTransforms($), opts?.samples)
9999
),
100100

101101
complexpoly: ($, opts) =>
@@ -114,7 +114,11 @@ export const asAxiDraw: MultiFn1O<
114114
// ignore sample opts for polyline & other polygonal shapes
115115
// i.e. use points verbatim
116116
polyline: ($, opts) =>
117-
__polyline(asPolyline(applyTransforms($)).points, $.attribs, opts),
117+
__polyline(
118+
asPolyline(applyTransforms($))[0].points,
119+
$.attribs,
120+
opts
121+
),
118122

119123
group: ($, opts) => __group(<Group>$, opts),
120124
}

0 commit comments

Comments
 (0)