Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] - Arguments for radius not allowed in TypeScript for rectangles #969

Closed
1 of 4 tasks
ln56b opened this issue Jun 23, 2021 · 1 comment
Closed
1 of 4 tasks
Assignees
Milestone

Comments

@ln56b
Copy link

ln56b commented Jun 23, 2021

Category

  • Enhancement
  • Bug
  • Question
  • Documentation gap/issue

Version

Please specify what version of the library you are using: [ 3.5.0 ]

Expected / Desired Behavior / Question

I need to add a radius to a rectangle shape when using the addText() method.
It should work as shown in the example provided from the documentation below

		shape: pptx.shapes.ROUNDED_RECTANGLE,
		x: 10,
		y: 2.5,
		w: 3.0,
		h: 1.5,
		r: 0.2,
		fill: { color: "00FF00" },
		align: "center",
		fontSize: 14,
		line: { color: "000000", size: 1, dashType: "dash" },
		rectRadius: 10,
	}); 

Observed Behavior

I am coding in TypeScript and cannot access the r: nor rectRadius: arguments.
I am using the method as below :

	slide.addText("ROUNDED-RECTANGLE\ndashType:dash\nrectRadius:10", {
		shape: pptx.shapeType.roundRect,
		x: 10,
		y: 2.5,
		w: 3.0,
		h: 1.5,
		fill: { color: "00FF00" },
		align: "center",
		fontSize: 14,
		line: { color: "000000", size: 1, dashType: "dash" },
		rectRadius: 10,
	}); 

And I receive the error

Argument of type '{ shape: PptxGenJS.ShapeType.rect; color: string; fontSize: Fonts; x: number; y: number; h: number; w: number; r: number; }' is not assignable to parameter of type 'TextPropsOptions'.

I tried all proposed rectangle shapes but none would work in my case if I need a custom radius.
Could you please check what is wrong here ?

Thanks

@gitbrent
Copy link
Owner

gitbrent commented Jul 6, 2021

Thanks @ln56b - the r prop should have been removed a while back and the rectRadius prop was not proerly defined in index.d.ts, plus its docs were not correct (the values are 0.0 to 1.0)

Screen Shot 2021-07-06 at 12 17 23

@gitbrent gitbrent closed this as completed Jul 6, 2021
gitbrent added a commit that referenced this issue Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants