diff options
| author | Arne Dußin | 2021-01-17 13:33:04 +0100 |
|---|---|---|
| committer | Arne Dußin | 2021-01-17 13:33:04 +0100 |
| commit | 51b7747e62c189d430318c67368a5c84e50ece61 (patch) | |
| tree | 328be6230d392027eb106fd963b5ec97b9034f9f /src/math/rect.rs | |
| parent | b1179849c28e50c39ac3c94af9dda86ee24beca0 (diff) | |
| download | graf_karto-51b7747e62c189d430318c67368a5c84e50ece61.tar.gz graf_karto-51b7747e62c189d430318c67368a5c84e50ece61.zip | |
Input revamp to make keybindings controlable.input
Diffstat (limited to 'src/math/rect.rs')
| -rw-r--r-- | src/math/rect.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/math/rect.rs b/src/math/rect.rs index adb608b..a8326bc 100644 --- a/src/math/rect.rs +++ b/src/math/rect.rs @@ -3,9 +3,9 @@ use super::{ExactSurface, LineSegment, Polygon, Vec2}; //use alga::general::{Additive, Identity}; use nalgebra::{RealField, Scalar}; -use num_traits::{NumCast, ToPrimitive}; +use num_traits::{NumCast, ToPrimitive, Zero}; use serde::{Deserialize, Serialize}; -use std::ops::{Add, AddAssign}; +use std::ops::{Add, AddAssign, Sub}; /// Represents a Rectangle with the value type T. #[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] @@ -149,7 +149,10 @@ impl<T: Scalar + Copy> Rect<T> { } } -impl<T: RealField> ExactSurface<T> for Rect<T> { +impl<T: Scalar + Copy> ExactSurface<T> for Rect<T> +where + T: Add<Output = T> + PartialOrd + Sub<Output = T> + Zero, +{ fn contains_point(&self, point: &Vec2<T>) -> bool { point.x >= self.x && point.x <= self.x + self.w |
