From 51b7747e62c189d430318c67368a5c84e50ece61 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Sun, 17 Jan 2021 13:33:04 +0100 Subject: Input revamp to make keybindings controlable. --- src/math/rect.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/math/rect.rs') 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 Rect { } } -impl ExactSurface for Rect { +impl ExactSurface for Rect +where + T: Add + PartialOrd + Sub + Zero, +{ fn contains_point(&self, point: &Vec2) -> bool { point.x >= self.x && point.x <= self.x + self.w -- cgit v1.2.3-70-g09d2