Skip to content

Commit

Permalink
fix(geom-axidraw): update group attrib handling
Browse files Browse the repository at this point in the history
- ensure `__samples` attrib is being properly merged
  • Loading branch information
postspectacular committed Jan 10, 2023
1 parent 9ff890a commit 7f5d9a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/geom-axidraw/src/as-axidraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { pointInPolygon2 } from "@thi.ng/geom-isec/point";
import { applyTransforms } from "@thi.ng/geom/apply-transforms";
import { asPolyline } from "@thi.ng/geom/as-polyline";
import { __dispatch } from "@thi.ng/geom/internal/dispatch";
import { __sampleAttribs } from "@thi.ng/geom/internal/vertices";
import { takeNth } from "@thi.ng/transducers/take-nth";
import type { ReadonlyVec } from "@thi.ng/vectors";
import type {
Expand Down Expand Up @@ -102,13 +103,15 @@ function* __group(
opts?: Partial<AsAxiDrawOpts>
): IterableIterator<DrawCommand> {
const { skip, sort } = __axiAttribs($.attribs);
const sopts = __sampleAttribs(opts?.samples, $.attribs);
const children = skip ? [...takeNth(skip + 1, $.children)] : $.children;
const childrenIter = sort ? (<ShapeOrdering>sort)(children) : children;
for (let child of childrenIter) {
const shape = applyTransforms(child);
shape.attribs = {
...shape.attribs,
...$.attribs,
...shape.attribs,
__samples: __sampleAttribs(sopts, shape.attribs),
};
yield* asAxiDraw(shape, opts);
}
Expand Down

0 comments on commit 7f5d9a3

Please sign in to comment.