From d91f4f6aa74d0693179a02167d626efa3ac4c20b Mon Sep 17 00:00:00 2001 From: Bingus Date: Sat, 19 Nov 2022 10:29:37 -0800 Subject: Add multidirectional scrolling capabilities to the existing Scrollable. --- core/src/size.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'core/src') diff --git a/core/src/size.rs b/core/src/size.rs index 31f3171b..a2c72926 100644 --- a/core/src/size.rs +++ b/core/src/size.rs @@ -1,5 +1,4 @@ use crate::{Padding, Vector}; -use std::f32; /// An amount of space in 2 dimensions. #[derive(Debug, Clone, Copy, PartialEq, Eq)] -- cgit From 9f85e0c721927f1e3bd195a998ec7a80ec0e7455 Mon Sep 17 00:00:00 2001 From: bungoboingo Date: Sat, 24 Dec 2022 21:27:44 -0800 Subject: Reworked Scrollable to account for lack of widget order guarantees. Fixed thumb "snapping" bug on scrollable when cursor is out of bounds. --- core/src/point.rs | 8 ++++++++ core/src/rectangle.rs | 6 ++++++ 2 files changed, 14 insertions(+) (limited to 'core/src') diff --git a/core/src/point.rs b/core/src/point.rs index 9bf7726b..d351befd 100644 --- a/core/src/point.rs +++ b/core/src/point.rs @@ -75,3 +75,11 @@ impl std::ops::Sub for Point { Vector::new(self.x - point.x, self.y - point.y) } } + +impl std::ops::Add for Point { + type Output = Point; + + fn add(self, point: Point) -> Point { + Point::new(self.x + point.x, self.y + point.y) + } +} diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index 4fe91519..c6e6fce4 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -111,6 +111,12 @@ impl Rectangle { } } +impl std::cmp::PartialOrd for Rectangle { + fn partial_cmp(&self, other: &Self) -> Option { + (self.width * self.height).partial_cmp(&(other.width * other.height)) + } +} + impl std::ops::Mul for Rectangle { type Output = Self; -- cgit From 624a4ada7981eb05c0b50cafa7e9545ad8347cb5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 8 Jan 2023 20:07:11 +0100 Subject: Introduce `RelativeOffset` type in `scrollable` --- core/src/point.rs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'core/src') diff --git a/core/src/point.rs b/core/src/point.rs index d351befd..9bf7726b 100644 --- a/core/src/point.rs +++ b/core/src/point.rs @@ -75,11 +75,3 @@ impl std::ops::Sub for Point { Vector::new(self.x - point.x, self.y - point.y) } } - -impl std::ops::Add for Point { - type Output = Point; - - fn add(self, point: Point) -> Point { - Point::new(self.x + point.x, self.y + point.y) - } -} -- cgit From f64e95e2469bd0f8012742a585c41c770634030e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 8 Jan 2023 20:19:36 +0100 Subject: Remove `PartialOrd` implementation for `Rectangle` A `PartialOrd` implementation is unclear for this type, since it has a position besides its dimensions. --- core/src/rectangle.rs | 6 ------ 1 file changed, 6 deletions(-) (limited to 'core/src') diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index c6e6fce4..4fe91519 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -111,12 +111,6 @@ impl Rectangle { } } -impl std::cmp::PartialOrd for Rectangle { - fn partial_cmp(&self, other: &Self) -> Option { - (self.width * self.height).partial_cmp(&(other.width * other.height)) - } -} - impl std::ops::Mul for Rectangle { type Output = Self; -- cgit