1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

⚠️ Rename Rounding to CornerRadius (#5673)

Breaking change!

* `Rounding` -> `CornerRadius`
* `rounding` -> `corner_radius`

This is to:
* Clarify
* Conform to other systems (e.g. Figma)
* Avoid confusion with `GuiRounding`
This commit is contained in:
Emil Ernerfeldt
2025-02-04 12:53:18 +01:00
committed by GitHub
parent 3c07e01d08
commit 23ed49334e
44 changed files with 378 additions and 330 deletions

View File

@@ -10,7 +10,7 @@ pub struct RectShape {
/// How rounded the corners of the rectangle are.
///
/// Use `Rounding::ZERO` for for sharp corners.
/// Use [`CornerRadius::ZERO`] for for sharp corners.
///
/// This is the corner radii of the rectangle.
/// If there is a stroke, then the stroke will have an inner and outer corner radius,
@@ -18,7 +18,7 @@ pub struct RectShape {
///
/// For [`StrokeKind::Inside`], the outside of the stroke coincides with the rectangle,
/// so the rounding will in this case specify the outer corner radius.
pub rounding: Rounding,
pub corner_radius: CornerRadius,
/// How to fill the rectangle.
pub fill: Color32,
@@ -73,14 +73,14 @@ impl RectShape {
#[inline]
pub fn new(
rect: Rect,
rounding: impl Into<Rounding>,
corner_radius: impl Into<CornerRadius>,
fill_color: impl Into<Color32>,
stroke: impl Into<Stroke>,
stroke_kind: StrokeKind,
) -> Self {
Self {
rect,
rounding: rounding.into(),
corner_radius: corner_radius.into(),
fill: fill_color.into(),
stroke: stroke.into(),
stroke_kind,
@@ -93,12 +93,12 @@ impl RectShape {
#[inline]
pub fn filled(
rect: Rect,
rounding: impl Into<Rounding>,
corner_radius: impl Into<CornerRadius>,
fill_color: impl Into<Color32>,
) -> Self {
Self::new(
rect,
rounding,
corner_radius,
fill_color,
Stroke::NONE,
StrokeKind::Outside, // doesn't matter
@@ -108,12 +108,12 @@ impl RectShape {
#[inline]
pub fn stroke(
rect: Rect,
rounding: impl Into<Rounding>,
corner_radius: impl Into<CornerRadius>,
stroke: impl Into<Stroke>,
stroke_kind: StrokeKind,
) -> Self {
let fill = Color32::TRANSPARENT;
Self::new(rect, rounding, fill, stroke, stroke_kind)
Self::new(rect, corner_radius, fill, stroke, stroke_kind)
}
/// Set if the stroke is on the inside, outside, or centered on the rectangle.