Skip to content

Commit

Permalink
fix(packages_simple-pie): doughnut inner option ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
serjilyashenko committed Jun 21, 2024
1 parent 9b1ce36 commit b360a88
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-masks-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"simple-pie": patch
---

Bug fix: Doughnut inner option ignored (https://github.com/serjilyashenko/simple-pie-project/issues/11)
2 changes: 1 addition & 1 deletion packages/pie-math/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function buildPieSectors(values: Array<number>): Array<string> {

export function buildDoughnutSectors(
values: Array<number>,
inner: number = 0.5,
inner: number,
): Array<string> {
const angleCoordinates: Array<TSectorCoordinate> = castValuesToAngles(values);

Expand Down
7 changes: 5 additions & 2 deletions packages/simple-pie/src/simple-pie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ export function simpleDoughnutElement(
options: TDoughnutOptions = {},
): SVGElement {
const resultOptions = { ...defaultDoughnutOptions, ...options };
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { inner, ...pieOptions } = resultOptions;

return _buildSvgElement(buildDoughnutSectors, values, pieOptions);
return _buildSvgElement(
(_values) => buildDoughnutSectors(_values, inner),
values,
pieOptions,
);
}

export const simplePie = simplePieElement;
Expand Down

0 comments on commit b360a88

Please sign in to comment.