mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Replace uses of RangeInclusive<f32> with emath::Rangef (#3221)
* Replace uses of `RangeInclusive<f32>` with `emath::Rangef` * Fix doc-test
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use std::f32::INFINITY;
|
||||
use std::ops::RangeInclusive;
|
||||
|
||||
use crate::*;
|
||||
|
||||
@@ -82,15 +81,12 @@ impl Rect {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn from_x_y_ranges(
|
||||
x_range: impl Into<RangeInclusive<f32>>,
|
||||
y_range: impl Into<RangeInclusive<f32>>,
|
||||
) -> Self {
|
||||
pub fn from_x_y_ranges(x_range: impl Into<Rangef>, y_range: impl Into<Rangef>) -> Self {
|
||||
let x_range = x_range.into();
|
||||
let y_range = y_range.into();
|
||||
Rect {
|
||||
min: pos2(*x_range.start(), *y_range.start()),
|
||||
max: pos2(*x_range.end(), *y_range.end()),
|
||||
min: pos2(x_range.min, y_range.min),
|
||||
max: pos2(x_range.max, y_range.max),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,18 +386,18 @@ impl Rect {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn x_range(&self) -> RangeInclusive<f32> {
|
||||
self.min.x..=self.max.x
|
||||
pub fn x_range(&self) -> Rangef {
|
||||
Rangef::new(self.min.x, self.max.x)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn y_range(&self) -> RangeInclusive<f32> {
|
||||
self.min.y..=self.max.y
|
||||
pub fn y_range(&self) -> Rangef {
|
||||
Rangef::new(self.min.y, self.max.y)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn bottom_up_range(&self) -> RangeInclusive<f32> {
|
||||
self.max.y..=self.min.y
|
||||
pub fn bottom_up_range(&self) -> Rangef {
|
||||
Rangef::new(self.max.y, self.min.y)
|
||||
}
|
||||
|
||||
/// `width < 0 || height < 0`
|
||||
|
||||
Reference in New Issue
Block a user