Skip to content

Commit d6018d5

Browse files
authored
chore: make cx and cy optional in Circle and Ellipse (#2314)
1 parent dfb46c1 commit d6018d5

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

.changeset/warm-needles-cough.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@react-pdf/renderer': patch
3+
'@react-pdf/render': patch
4+
---
5+
6+
Make `cx` and `cy` optional in `Circle` and `Ellipse`

packages/render/src/primitives/renderEllipse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const KAPPA = 4.0 * ((Math.sqrt(2) - 1.0) / 3.0);
22

3-
export const drawEllipse = (ctx, cx, cy, rx, ry) => {
3+
export const drawEllipse = (ctx, cx = 0, cy = 0, rx, ry) => {
44
const x = cx - rx;
55
const y = cy - ry;
66
const ox = rx * KAPPA;

packages/renderer/index.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ declare namespace ReactPDF {
3232
language?: string;
3333
pdfVersion?: PDFVersion;
3434
pageMode?: PageMode;
35-
pageLayout ?: PageLayout;
35+
pageLayout?: PageLayout;
3636
onRender?: (props: OnRenderProps) => any;
3737
}
3838

@@ -318,8 +318,8 @@ declare namespace ReactPDF {
318318

319319
interface CircleProps extends SVGPresentationAttributes {
320320
style?: SVGPresentationAttributes;
321-
cx: string | number;
322-
cy: string | number;
321+
cx?: string | number;
322+
cy?: string | number;
323323
r: string | number;
324324
}
325325

@@ -330,8 +330,8 @@ declare namespace ReactPDF {
330330

331331
interface EllipseProps extends SVGPresentationAttributes {
332332
style?: SVGPresentationAttributes;
333-
cx: string | number;
334-
cy: string | number;
333+
cx?: string | number;
334+
cy?: string | number;
335335
rx: string | number;
336336
ry: string | number;
337337
}

0 commit comments

Comments
 (0)