Skip to content

Commit

Permalink
refactor(geom): update Path & PathBuilder.close()
Browse files Browse the repository at this point in the history
BREAKING CHANGE: rename `PathBuilder.closePath()` => `PathBuilder.close()`

- update `Path.close()` to return path itself
  • Loading branch information
postspectacular committed May 7, 2024
1 parent 88b2c40 commit b2134c2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/geom/src/api/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class Path implements IClear, IHiccupShape {

close() {
if (!this.closed) this.segments.push(CLOSE);
return this;
}

copy(): Path {
Expand Down
2 changes: 1 addition & 1 deletion packages/geom/src/path-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class PathBuilder {
return this;
}

closePath() {
close() {
this.curr.addSegments({
geo: new Line([copy(this.currP), copy(this.startP)]),
type: "l",
Expand Down
2 changes: 1 addition & 1 deletion packages/geom/src/path-from-svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const pathFromSvg = (svg: string) => {
break;
}
case "z":
b.closePath();
b.close();
break;
default:
throw new Error(
Expand Down

0 comments on commit b2134c2

Please sign in to comment.