diff options
author | 2020-04-29 20:58:59 +0200 | |
---|---|---|
committer | 2020-04-29 20:58:59 +0200 | |
commit | 5d12e194f45b4a01034f3f52fae16c10bc0192dd (patch) | |
tree | b2f566770daa8cf0206c92328b8b31074a79b8ab /wgpu/src/widget | |
parent | 70f86f998b6db102d5b77f756750414efd53aa9e (diff) | |
download | iced-5d12e194f45b4a01034f3f52fae16c10bc0192dd.tar.gz iced-5d12e194f45b4a01034f3f52fae16c10bc0192dd.tar.bz2 iced-5d12e194f45b4a01034f3f52fae16c10bc0192dd.zip |
Rename `Cursor::*_position` methods in `canvas`
Diffstat (limited to 'wgpu/src/widget')
-rw-r--r-- | wgpu/src/widget/canvas/cursor.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/wgpu/src/widget/canvas/cursor.rs b/wgpu/src/widget/canvas/cursor.rs index a559782a..7ab58b87 100644 --- a/wgpu/src/widget/canvas/cursor.rs +++ b/wgpu/src/widget/canvas/cursor.rs @@ -24,23 +24,23 @@ impl Cursor { } } - pub fn relative_position(&self, bounds: &Rectangle) -> Option<Point> { - match self { - Cursor::Available(position) => { - Some(Point::new(position.x - bounds.x, position.y - bounds.y)) - } - _ => None, - } - } - - pub fn internal_position(&self, bounds: &Rectangle) -> Option<Point> { + pub fn position_in(&self, bounds: &Rectangle) -> Option<Point> { if self.is_over(bounds) { - self.relative_position(bounds) + self.position_from(bounds.position()) } else { None } } + pub fn position_from(&self, origin: Point) -> Option<Point> { + match self { + Cursor::Available(position) => { + Some(Point::new(position.x - origin.x, position.y - origin.y)) + } + Cursor::Unavailable => None, + } + } + pub fn is_over(&self, bounds: &Rectangle) -> bool { match self { Cursor::Available(position) => bounds.contains(*position), |