Skip to content

Commit

Permalink
refactor(geom): minor update complex poly hiccup serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jun 19, 2024
1 parent 5907a2a commit b394842
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/geom/src/api/complex-polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class ComplexPolygon implements IHiccupShape2<ComplexPolygon> {
for (let i = 1, n = points.length; i < n; i++) {
segments.push(["L", points[i]]);
}
segments.push(["Z"]);
segments.push(["z"]);
};
$hiccupSegments(this.boundary);
for (let c of this.children) $hiccupSegments(c);
Expand Down
4 changes: 2 additions & 2 deletions packages/geom/test/complex-poly.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe("complex poly", () => {
'<path d="M-50,-50H50V50H-50V-50zM-25,25H25V-25H-25V25z"/>'
);
expect(asSvg(asPath(A, {}))).toBe(
'<path d="M0,-50C16.667,-50,50,-16.667,50,0C50,16.667,16.667,50,0,50C-16.667,50,-50,16.667,-50,0C-50,-16.667,-16.667,-50,0,-50M0,25C8.333,25,25,8.333,25,0C25,-8.333,8.333,-25,0,-25C-8.333,-25,-25,-8.333,-25,0C-25,8.333,-8.333,25,0,25"/>'
'<path d="M0,-50C16.667,-50,50,-16.667,50,0C50,16.667,16.667,50,0,50C-16.667,50,-50,16.667,-50,0C-50,-16.667,-16.667,-50,0,-50zM0,25C8.333,25,25,8.333,25,0C25,-8.333,8.333,-25,0,-25C-8.333,-25,-25,-8.333,-25,0C-25,8.333,-8.333,25,0,25z"/>'
);
});

Expand All @@ -48,7 +48,7 @@ describe("complex poly", () => {

test("asSvg", () => {
expect(asSvg(A)).toBe(
'<path d="M-50,-50L50,-50L50,50L-50,50ZM-25,25L25,25L25,-25L-25,-25Z"/>'
'<path d="M-50,-50L50,-50L50,50L-50,50zM-25,25L25,25L25,-25L-25,-25z"/>'
);
});

Expand Down

0 comments on commit b394842

Please sign in to comment.