canvas-ui icon indicating copy to clipboard operation
canvas-ui copied to clipboard

fix(RenderCircle): auto-set size to diameter for correct bounding box

Open myers opened this issue 2 months ago • 0 comments

Hello! 您好

I ran into this while attempting to create a slider component.

This PR fixes RenderCircle to automatically set its size (width/height) to the diameter (radius * 2) when the radius property is set, ensuring the bounding box is correct and consistent with RenderRect and RenderRRect.

Changes:

  • RenderCircle.handleRadiusChange(): automatically sets size to diameter when radius is set, or to 0x0 when radius is 0
  • Updated render-circle.stories.tsx to use radius API instead of manually setting width/height

Benefits:

  • Bounding box now correctly matches the visual circle size
  • Consistent behavior with other shape components (Rect, RRect)
  • Simplifies usage - users only need to set radius, not width/height

myers avatar Oct 28 '25 12:10 myers