Skip to content

Commit 0960817

Browse files
refactor(geom): update area() impl for Path
1 parent d133bbe commit 0960817

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/geom/src/area.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ export const area: MultiFn1O<IShape, boolean, number> = defmulti(
7575
group: ({ children }: Group) =>
7676
children.reduce((sum, $) => sum + area($, false), 0),
7777

78-
path: ($: Path) => {
79-
if (!$.closed) return 0;
80-
return asPolygon($).reduce((acc, p) => acc + area(p, true), 0);
78+
path: ($: Path, signed?) => {
79+
return $.closed
80+
? asPolygon($).reduce((acc, p) => acc + area(p, signed), 0)
81+
: 0;
8182
},
8283

8384
plane: () => Infinity,

0 commit comments

Comments
 (0)