1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Replace emath::clamp with f32::clamp (new in rustc 1.50)

This commit is contained in:
Emil Ernerfeldt
2021-03-21 17:47:03 +01:00
parent cdab9d777f
commit f5c372910c
16 changed files with 66 additions and 63 deletions

View File

@@ -1,4 +1,4 @@
use std::ops::{Add, AddAssign, RangeInclusive, Sub, SubAssign};
use std::ops::{Add, AddAssign, Sub, SubAssign};
use crate::*;
@@ -143,10 +143,10 @@ impl Pos2 {
}
#[must_use]
pub fn clamp(self, range: RangeInclusive<Self>) -> Self {
pub fn clamp(self, min: Self, max: Self) -> Self {
Self {
x: clamp(self.x, range.start().x..=range.end().x),
y: clamp(self.y, range.start().y..=range.end().y),
x: self.x.clamp(min.x, max.x),
y: self.y.clamp(min.y, max.y),
}
}
}