diff options
author | 2023-06-09 21:53:54 +0200 | |
---|---|---|
committer | 2023-06-09 21:53:54 +0200 | |
commit | 60cd864d43be877a5eaee4f5ca32f41b9fb70b79 (patch) | |
tree | 01a7758d3b8a4d2434bba113df85c6cb2c3e2ca2 /examples/sierpinski_triangle/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/sierpinski_triangle/src')
-rw-r--r-- | examples/sierpinski_triangle/src/main.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/sierpinski_triangle/src/main.rs b/examples/sierpinski_triangle/src/main.rs index 4faac6d6..885d3c63 100644 --- a/examples/sierpinski_triangle/src/main.rs +++ b/examples/sierpinski_triangle/src/main.rs @@ -1,6 +1,7 @@ use std::fmt::Debug; use iced::executor; +use iced::mouse; use iced::widget::canvas::event::{self, Event}; use iced::widget::canvas::{self, Canvas}; use iced::widget::{column, row, slider, text}; @@ -105,14 +106,14 @@ impl canvas::Program<Message> for SierpinskiGraph { _state: &mut Self::State, event: Event, bounds: Rectangle, - cursor: canvas::Cursor, + cursor: mouse::Cursor, ) -> (event::Status, Option<Message>) { - let cursor_position = - if let Some(position) = cursor.position_in(&bounds) { - position - } else { - return (event::Status::Ignored, None); - }; + let cursor_position = if let Some(position) = cursor.position_in(bounds) + { + position + } else { + return (event::Status::Ignored, None); + }; match event { Event::Mouse(mouse_event) => { @@ -137,7 +138,7 @@ impl canvas::Program<Message> for SierpinskiGraph { renderer: &Renderer, _theme: &Theme, bounds: Rectangle, - _cursor: canvas::Cursor, + _cursor: mouse::Cursor, ) -> Vec<canvas::Geometry> { let geom = self.cache.draw(renderer, bounds.size(), |frame| { frame.stroke( |