summaryrefslogtreecommitdiffstats
path: root/src/rectangle.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-08-31 04:31:13 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-08-31 04:31:13 +0200
commiteecac7b5d163794645bcce8e450c74e3eb5e999f (patch)
treebf55576b1941bffae422050f72e7c9a6c1c0d282 /src/rectangle.rs
parent343cafa1ee0b6d29d6e739dfebb13ebe3656a9aa (diff)
downloadiced-eecac7b5d163794645bcce8e450c74e3eb5e999f.tar.gz
iced-eecac7b5d163794645bcce8e450c74e3eb5e999f.tar.bz2
iced-eecac7b5d163794645bcce8e450c74e3eb5e999f.zip
Remove `nalgebra` dependency
- Implement our own `Point` and `Vector` types - Make `Rectangle` not generic
Diffstat (limited to '')
-rw-r--r--src/rectangle.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/rectangle.rs b/src/rectangle.rs
index ca224dad..9f2a1350 100644
--- a/src/rectangle.rs
+++ b/src/rectangle.rs
@@ -1,25 +1,25 @@
use crate::Point;
-/// A generic rectangle.
-#[derive(Debug, PartialEq, Eq, Copy, Clone)]
-pub struct Rectangle<T> {
+/// A rectangle.
+#[derive(Debug, PartialEq, Copy, Clone)]
+pub struct Rectangle {
/// X coordinate of the top-left corner.
- pub x: T,
+ pub x: f32,
/// Y coordinate of the top-left corner.
- pub y: T,
+ pub y: f32,
/// Width of the rectangle.
- pub width: T,
+ pub width: f32,
/// Height of the rectangle.
- pub height: T,
+ pub height: f32,
}
-impl Rectangle<f32> {
+impl Rectangle {
/// Returns true if the given [`Point`] is contained in the [`Rectangle`].
///
- /// [`Point`]: type.Point.html
+ /// [`Point`]: struct.Point.html
/// [`Rectangle`]: struct.Rectangle.html
pub fn contains(&self, point: Point) -> bool {
self.x <= point.x