Take Event by reference in Widget::update

This commit is contained in:
Héctor Ramón Jiménez 2025-02-03 03:22:10 +01:00
parent 1b01d6718b
commit afef368d8a
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
49 changed files with 111 additions and 155 deletions

View file

@ -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>> {

View file

@ -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

View file

@ -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();

View file

@ -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();
}

View file

@ -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 },

View file

@ -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>> {

View file

@ -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,