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

Nicer styling of tabs

This commit is contained in:
Emil Ernerfeldt
2023-05-04 15:06:24 +02:00
parent 3f02c7d698
commit f2d6885a6b
5 changed files with 230 additions and 120 deletions

View File

@@ -11,6 +11,25 @@ pub struct Rangef {
}
impl Rangef {
/// Infinite range that contains everything, from -∞ to +∞, inclusive.
pub const EVERYTHING: Self = Self {
min: f32::NEG_INFINITY,
max: f32::INFINITY,
};
/// The inverse of [`Self::EVERYTHING`]: stretches from positive infinity to negative infinity.
/// Contains nothing.
pub const NOTHING: Self = Self {
min: f32::INFINITY,
max: f32::NEG_INFINITY,
};
/// An invalid [`Rangef`] filled with [`f32::NAN`].
pub const NAN: Self = Self {
min: f32::NAN,
max: f32::NAN,
};
#[inline]
pub fn new(min: f32, max: f32) -> Self {
Self { min, max }
@@ -34,6 +53,13 @@ impl From<Rangef> for RangeInclusive<f32> {
}
}
impl From<&Rangef> for RangeInclusive<f32> {
#[inline]
fn from(&Rangef { min, max }: &Rangef) -> Self {
min..=max
}
}
impl From<RangeInclusive<f32>> for Rangef {
#[inline]
fn from(range: RangeInclusive<f32>) -> Self {

View File

@@ -53,7 +53,7 @@ impl Rect {
max: pos2(-INFINITY, -INFINITY),
};
/// An invalid [`Rect`] filled with [`f32::NAN`];
/// An invalid [`Rect`] filled with [`f32::NAN`].
pub const NAN: Self = Self {
min: pos2(f32::NAN, f32::NAN),
max: pos2(f32::NAN, f32::NAN),