Skip to content

Commit

Permalink
refactor(geom): rename sector() => asSector(), minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed May 25, 2024
1 parent aacfc08 commit d1fb9bf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions packages/geom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@
"./as-polyline": {
"default": "./as-polyline.js"
},
"./as-sector": {
"default": "./as-sector.js"
},
"./as-svg": {
"default": "./as-svg.js"
},
Expand Down Expand Up @@ -406,9 +409,6 @@
"./scatter": {
"default": "./scatter.js"
},
"./sector": {
"default": "./sector.js"
},
"./simplify": {
"default": "./simplify.js"
},
Expand Down
22 changes: 11 additions & 11 deletions packages/geom/src/sector.ts → packages/geom/src/as-sector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import { __copyAttribsRaw } from "./internal/copy.js";
* @param arc
* @param attribs
*/
export const sector = (arc: Arc, attribs?: Attribs) => {
const path = new Path();
path.addSegments(
{ type: "m", point: copy(arc.pos) },
{ type: "l", geo: new Line([copy(arc.pos), arc.pointAt(0)]) },
{ type: "a", geo: arc },
{ type: "l", geo: new Line([arc.pointAt(1), copy(arc.pos)]) },
{ type: "z" }
export const asSector = (arc: Arc, attribs?: Attribs) =>
new Path(
[
{ type: "m", point: copy(arc.pos) },
{ type: "l", geo: new Line([copy(arc.pos), arc.pointAt(0)]) },
{ type: "a", geo: arc },
{ type: "l", geo: new Line([arc.pointAt(1), copy(arc.pos)]) },
{ type: "z" },
],
[],
attribs || __copyAttribsRaw(arc.attribs)
);
path.attribs = attribs || __copyAttribsRaw(arc.attribs);
return path;
};
2 changes: 1 addition & 1 deletion packages/geom/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export * from "./as-cubic.js";
export * from "./as-path.js";
export * from "./as-polygon.js";
export * from "./as-polyline.js";
export * from "./as-sector.js";
export * from "./as-svg.js";
export * from "./bounds.js";
export * from "./center.js";
Expand All @@ -97,7 +98,6 @@ export * from "./rotate-around-axis.js";
export * from "./scale.js";
export * from "./scale-with-center.js";
export * from "./scatter.js";
export * from "./sector.js";
export * from "./simplify.js";
export * from "./split-arclength.js";
export * from "./split-at.js";
Expand Down

0 comments on commit d1fb9bf

Please sign in to comment.