diff options
author | 2023-06-09 21:53:54 +0200 | |
---|---|---|
committer | 2023-06-09 21:53:54 +0200 | |
commit | 60cd864d43be877a5eaee4f5ca32f41b9fb70b79 (patch) | |
tree | 01a7758d3b8a4d2434bba113df85c6cb2c3e2ca2 /examples/bezier_tool/src | |
parent | c15f1b5f6575792cc89bb5fba2e613428397e46a (diff) | |
parent | 27639c4ce6161fa07986c2f1d472a8a259ae2129 (diff) | |
download | iced-60cd864d43be877a5eaee4f5ca32f41b9fb70b79.tar.gz iced-60cd864d43be877a5eaee4f5ca32f41b9fb70b79.tar.bz2 iced-60cd864d43be877a5eaee4f5ca32f41b9fb70b79.zip |
Merge pull request #1904 from iced-rs/cursor-availability
Cursor availability
Diffstat (limited to 'examples/bezier_tool/src')
-rw-r--r-- | examples/bezier_tool/src/main.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index f1c83a16..310be28f 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -61,9 +61,7 @@ impl Sandbox for Example { mod bezier { use iced::mouse; use iced::widget::canvas::event::{self, Event}; - use iced::widget::canvas::{ - self, Canvas, Cursor, Frame, Geometry, Path, Stroke, - }; + use iced::widget::canvas::{self, Canvas, Frame, Geometry, Path, Stroke}; use iced::{Element, Length, Point, Rectangle, Renderer, Theme}; #[derive(Default)] @@ -100,10 +98,10 @@ mod bezier { state: &mut Self::State, event: Event, bounds: Rectangle, - cursor: Cursor, + cursor: mouse::Cursor, ) -> (event::Status, Option<Curve>) { let cursor_position = - if let Some(position) = cursor.position_in(&bounds) { + if let Some(position) = cursor.position_in(bounds) { position } else { return (event::Status::Ignored, None); @@ -155,7 +153,7 @@ mod bezier { renderer: &Renderer, _theme: &Theme, bounds: Rectangle, - cursor: Cursor, + cursor: mouse::Cursor, ) -> Vec<Geometry> { let content = self.state.cache.draw( renderer, @@ -183,9 +181,9 @@ mod bezier { &self, _state: &Self::State, bounds: Rectangle, - cursor: Cursor, + cursor: mouse::Cursor, ) -> mouse::Interaction { - if cursor.is_over(&bounds) { + if cursor.is_over(bounds) { mouse::Interaction::Crosshair } else { mouse::Interaction::default() @@ -224,11 +222,11 @@ mod bezier { &self, renderer: &Renderer, bounds: Rectangle, - cursor: Cursor, + cursor: mouse::Cursor, ) -> Geometry { let mut frame = Frame::new(renderer, bounds.size()); - if let Some(cursor_position) = cursor.position_in(&bounds) { + if let Some(cursor_position) = cursor.position_in(bounds) { match *self { Pending::One { from } => { let line = Path::line(from, cursor_position); |