1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Remove fallback_gap

This commit is contained in:
Lucas Meurer
2026-08-27 13:18:57 +02:00
parent 80ff62e2be
commit 72699b7032
3 changed files with 7 additions and 11 deletions

View File

@@ -107,13 +107,6 @@ impl<'a> AtomLayout<'a> {
self
}
/// Set the gap between atoms, unless [`Self::gap`] already set one.
#[inline]
pub fn fallback_gap(mut self, gap: f32) -> Self {
self.gap.get_or_insert(gap);
self
}
/// Set the [`Frame`].
#[inline]
pub fn frame(mut self, frame: Frame) -> Self {

View File

@@ -89,8 +89,6 @@ impl StyleProvider<ButtonStyle> for DefaultStyle {
..Default::default()
},
layout: LayoutStyle {
// Historically only the height was floored, so that a button is at least as tall
// as any other interactive widget on the same row.
min_size: Vec2::new(0.0, spacing.interact_size.y),
gap: spacing.icon_spacing,
},

View File

@@ -35,6 +35,7 @@ pub struct Button<'a> {
frame_when_inactive: bool,
min_size: Vec2,
corner_radius: Option<CornerRadius>,
gap: Option<f32>,
selected: Option<bool>,
image_tint_follows_text_color: bool,
limit_image_size: bool,
@@ -54,6 +55,7 @@ impl<'a> Button<'a> {
frame_when_inactive: true,
min_size: Vec2::ZERO,
corner_radius: None,
gap: None,
selected: None,
image_tint_follows_text_color: false,
limit_image_size: false,
@@ -273,9 +275,11 @@ impl<'a> Button<'a> {
}
/// Set the gap between atoms.
///
/// Overrides the gap the theme picked.
#[inline]
pub fn gap(mut self, gap: f32) -> Self {
self.layout = self.layout.gap(gap);
self.gap = Some(gap);
self
}
@@ -297,6 +301,7 @@ impl<'a> Button<'a> {
frame_when_inactive,
mut min_size,
corner_radius,
gap: gap_override,
selected,
image_tint_follows_text_color,
limit_image_size,
@@ -333,7 +338,7 @@ impl<'a> Button<'a> {
text_style,
} = ui.widget_style(id, &classes);
layout = layout.fallback_gap(gap);
layout = layout.gap(gap_override.unwrap_or(gap));
// The theme decides how small a button may get — unless it is a `small` one, which sizes
// itself purely from its contents.