diff options
author | 2025-02-03 03:22:10 +0100 | |
---|---|---|
committer | 2025-02-04 01:26:59 +0100 | |
commit | afef368d8a920c7702048d3b1604b2046fe46ff8 (patch) | |
tree | 956ce409f5969cfd6b163796f141213c6235b805 /examples | |
parent | 1b01d6718bf0c6b652a3256df51727c3e72fdd9e (diff) | |
download | iced-afef368d8a920c7702048d3b1604b2046fe46ff8.tar.gz iced-afef368d8a920c7702048d3b1604b2046fe46ff8.tar.bz2 iced-afef368d8a920c7702048d3b1604b2046fe46ff8.zip |
Take `Event` by reference in `Widget::update`
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bezier_tool/src/main.rs | 2 | ||||
-rw-r--r-- | examples/game_of_life/src/main.rs | 4 | ||||
-rw-r--r-- | examples/loading_spinners/src/circular.rs | 4 | ||||
-rw-r--r-- | examples/loading_spinners/src/linear.rs | 4 | ||||
-rw-r--r-- | examples/multitouch/src/main.rs | 4 | ||||
-rw-r--r-- | examples/sierpinski_triangle/src/main.rs | 2 | ||||
-rw-r--r-- | examples/toast/src/main.rs | 6 |
7 files changed, 13 insertions, 13 deletions
diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index 4d438bd9..95ad299d 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -93,7 +93,7 @@ mod bezier { fn update( &self, state: &mut Self::State, - event: Event, + event: &Event, bounds: Rectangle, cursor: mouse::Cursor, ) -> Option<canvas::Action<Curve>> { diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs index 1008e477..dec3df7f 100644 --- a/examples/game_of_life/src/main.rs +++ b/examples/game_of_life/src/main.rs @@ -380,7 +380,7 @@ mod grid { fn update( &self, interaction: &mut Interaction, - event: Event, + event: &Event, bounds: Rectangle, cursor: mouse::Cursor, ) -> Option<canvas::Action<Message>> { @@ -471,7 +471,7 @@ mod grid { _ => action.and_capture(), }) } - mouse::Event::WheelScrolled { delta } => match delta { + mouse::Event::WheelScrolled { delta } => match *delta { mouse::ScrollDelta::Lines { y, .. } | mouse::ScrollDelta::Pixels { y, .. } => { if y < 0.0 && self.scaling > Self::MIN_SCALING diff --git a/examples/loading_spinners/src/circular.rs b/examples/loading_spinners/src/circular.rs index 33232fac..24293138 100644 --- a/examples/loading_spinners/src/circular.rs +++ b/examples/loading_spinners/src/circular.rs @@ -264,7 +264,7 @@ where fn update( &mut self, tree: &mut Tree, - event: Event, + event: &Event, _layout: Layout<'_>, _cursor: mouse::Cursor, _renderer: &Renderer, @@ -278,7 +278,7 @@ where state.animation = state.animation.timed_transition( self.cycle_duration, self.rotation_duration, - now, + *now, ); state.cache.clear(); diff --git a/examples/loading_spinners/src/linear.rs b/examples/loading_spinners/src/linear.rs index a10b64f0..a6713c7a 100644 --- a/examples/loading_spinners/src/linear.rs +++ b/examples/loading_spinners/src/linear.rs @@ -178,7 +178,7 @@ where fn update( &mut self, tree: &mut Tree, - event: Event, + event: &Event, _layout: Layout<'_>, _cursor: mouse::Cursor, _renderer: &Renderer, @@ -189,7 +189,7 @@ where let state = tree.state.downcast_mut::<State>(); if let Event::Window(window::Event::RedrawRequested(now)) = event { - *state = state.timed_transition(self.cycle_duration, now); + *state = state.timed_transition(self.cycle_duration, *now); shell.request_redraw(); } diff --git a/examples/multitouch/src/main.rs b/examples/multitouch/src/main.rs index 5f4a5c90..bda3b8f7 100644 --- a/examples/multitouch/src/main.rs +++ b/examples/multitouch/src/main.rs @@ -55,11 +55,11 @@ impl canvas::Program<Message> for Multitouch { fn update( &self, _state: &mut Self::State, - event: Event, + event: &Event, _bounds: Rectangle, _cursor: mouse::Cursor, ) -> Option<canvas::Action<Message>> { - let message = match event { + let message = match event.clone() { Event::Touch( touch::Event::FingerPressed { id, position } | touch::Event::FingerMoved { id, position }, diff --git a/examples/sierpinski_triangle/src/main.rs b/examples/sierpinski_triangle/src/main.rs index d4d483f5..a4a89455 100644 --- a/examples/sierpinski_triangle/src/main.rs +++ b/examples/sierpinski_triangle/src/main.rs @@ -76,7 +76,7 @@ impl canvas::Program<Message> for SierpinskiGraph { fn update( &self, _state: &mut Self::State, - event: Event, + event: &Event, bounds: Rectangle, cursor: mouse::Cursor, ) -> Option<canvas::Action<Message>> { diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index 2ae9bfe2..dc314df8 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -361,7 +361,7 @@ mod toast { fn update( &mut self, state: &mut Tree, - event: Event, + event: &Event, layout: Layout<'_>, cursor: mouse::Cursor, renderer: &Renderer, @@ -491,7 +491,7 @@ mod toast { fn update( &mut self, - event: Event, + event: &Event, layout: Layout<'_>, cursor: mouse::Cursor, renderer: &Renderer, @@ -530,7 +530,7 @@ mod toast { child.as_widget_mut().update( state, - event.clone(), + event, layout, cursor, renderer, |