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:
@@ -107,13 +107,6 @@ impl<'a> AtomLayout<'a> {
|
|||||||
self
|
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`].
|
/// Set the [`Frame`].
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn frame(mut self, frame: Frame) -> Self {
|
pub fn frame(mut self, frame: Frame) -> Self {
|
||||||
|
|||||||
@@ -89,8 +89,6 @@ impl StyleProvider<ButtonStyle> for DefaultStyle {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
layout: LayoutStyle {
|
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),
|
min_size: Vec2::new(0.0, spacing.interact_size.y),
|
||||||
gap: spacing.icon_spacing,
|
gap: spacing.icon_spacing,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ pub struct Button<'a> {
|
|||||||
frame_when_inactive: bool,
|
frame_when_inactive: bool,
|
||||||
min_size: Vec2,
|
min_size: Vec2,
|
||||||
corner_radius: Option<CornerRadius>,
|
corner_radius: Option<CornerRadius>,
|
||||||
|
gap: Option<f32>,
|
||||||
selected: Option<bool>,
|
selected: Option<bool>,
|
||||||
image_tint_follows_text_color: bool,
|
image_tint_follows_text_color: bool,
|
||||||
limit_image_size: bool,
|
limit_image_size: bool,
|
||||||
@@ -54,6 +55,7 @@ impl<'a> Button<'a> {
|
|||||||
frame_when_inactive: true,
|
frame_when_inactive: true,
|
||||||
min_size: Vec2::ZERO,
|
min_size: Vec2::ZERO,
|
||||||
corner_radius: None,
|
corner_radius: None,
|
||||||
|
gap: None,
|
||||||
selected: None,
|
selected: None,
|
||||||
image_tint_follows_text_color: false,
|
image_tint_follows_text_color: false,
|
||||||
limit_image_size: false,
|
limit_image_size: false,
|
||||||
@@ -273,9 +275,11 @@ impl<'a> Button<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Set the gap between atoms.
|
/// Set the gap between atoms.
|
||||||
|
///
|
||||||
|
/// Overrides the gap the theme picked.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn gap(mut self, gap: f32) -> Self {
|
pub fn gap(mut self, gap: f32) -> Self {
|
||||||
self.layout = self.layout.gap(gap);
|
self.gap = Some(gap);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,6 +301,7 @@ impl<'a> Button<'a> {
|
|||||||
frame_when_inactive,
|
frame_when_inactive,
|
||||||
mut min_size,
|
mut min_size,
|
||||||
corner_radius,
|
corner_radius,
|
||||||
|
gap: gap_override,
|
||||||
selected,
|
selected,
|
||||||
image_tint_follows_text_color,
|
image_tint_follows_text_color,
|
||||||
limit_image_size,
|
limit_image_size,
|
||||||
@@ -333,7 +338,7 @@ impl<'a> Button<'a> {
|
|||||||
text_style,
|
text_style,
|
||||||
} = ui.widget_style(id, &classes);
|
} = 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
|
// The theme decides how small a button may get — unless it is a `small` one, which sizes
|
||||||
// itself purely from its contents.
|
// itself purely from its contents.
|
||||||
|
|||||||
Reference in New Issue
Block a user