Skip to content

Commit

Permalink
Rename Overlay::on_event to update
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Nov 5, 2024
1 parent 03bffe3 commit e5f1e31
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion core/src/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ where
/// * a [`Clipboard`], if available
///
/// By default, it does nothing.
fn on_event(
fn update(
&mut self,
_event: Event,
_layout: Layout<'_>,
Expand Down
8 changes: 4 additions & 4 deletions core/src/overlay/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ where
}

/// Processes a runtime [`Event`].
pub fn on_event(
pub fn update(
&mut self,
event: Event,
layout: Layout<'_>,
Expand All @@ -59,7 +59,7 @@ where
shell: &mut Shell<'_, Message>,
) {
self.overlay
.on_event(event, layout, cursor, renderer, clipboard, shell);
.update(event, layout, cursor, renderer, clipboard, shell);
}

/// Returns the current [`mouse::Interaction`] of the [`Element`].
Expand Down Expand Up @@ -148,7 +148,7 @@ where
self.content.operate(layout, renderer, operation);
}

fn on_event(
fn update(
&mut self,
event: Event,
layout: Layout<'_>,
Expand All @@ -160,7 +160,7 @@ where
let mut local_messages = Vec::new();
let mut local_shell = Shell::new(&mut local_messages);

self.content.on_event(
self.content.update(
event,
layout,
cursor,
Expand Down
4 changes: 2 additions & 2 deletions core/src/overlay/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ where
)
}

fn on_event(
fn update(
&mut self,
event: Event,
layout: Layout<'_>,
Expand All @@ -82,7 +82,7 @@ where
shell: &mut Shell<'_, Message>,
) {
for (child, layout) in self.children.iter_mut().zip(layout.children()) {
child.on_event(
child.update(
event.clone(),
layout,
cursor,
Expand Down
2 changes: 1 addition & 1 deletion examples/toast/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ mod toast {
.translate(Vector::new(self.position.x, self.position.y))
}

fn on_event(
fn update(
&mut self,
event: Event,
layout: Layout<'_>,
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/overlay/nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ where
}

/// Processes a runtime [`Event`].
pub fn on_event(
pub fn update(
&mut self,
event: Event,
layout: Layout<'_>,
Expand Down Expand Up @@ -211,7 +211,7 @@ where
})
.unwrap_or_default();

element.on_event(
element.update(
event,
layout,
if nested_is_over {
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/user_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ where
for event in events.iter().cloned() {
let mut shell = Shell::new(messages);

overlay.on_event(
overlay.update(
event,
Layout::new(&layout),
cursor,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ where
.unwrap_or_default()
}

fn on_event(
fn update(
&mut self,
event: Event,
layout: Layout<'_>,
Expand All @@ -396,7 +396,7 @@ where
shell: &mut Shell<'_, Message>,
) {
let _ = self.with_overlay_mut_maybe(|overlay| {
overlay.on_event(event, layout, cursor, renderer, clipboard, shell);
overlay.update(event, layout, cursor, renderer, clipboard, shell);
});
}

Expand Down
4 changes: 2 additions & 2 deletions widget/src/lazy/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ where
.unwrap_or_default()
}

fn on_event(
fn update(
&mut self,
event: core::Event,
layout: Layout<'_>,
Expand All @@ -614,7 +614,7 @@ where
let mut local_shell = Shell::new(&mut local_messages);

let _ = self.with_overlay_mut_maybe(|overlay| {
overlay.on_event(
overlay.update(
event,
layout,
cursor,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/lazy/responsive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ where
.unwrap_or_default()
}

fn on_event(
fn update(
&mut self,
event: Event,
layout: Layout<'_>,
Expand All @@ -429,7 +429,7 @@ where
let mut is_layout_invalid = false;

let _ = self.with_overlay_mut_maybe(|overlay| {
overlay.on_event(event, layout, cursor, renderer, clipboard, shell);
overlay.update(event, layout, cursor, renderer, clipboard, shell);

is_layout_invalid = shell.is_layout_invalid();
});
Expand Down
2 changes: 1 addition & 1 deletion widget/src/overlay/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ where
})
}

fn on_event(
fn update(
&mut self,
event: Event,
layout: Layout<'_>,
Expand Down
2 changes: 1 addition & 1 deletion widget/src/pane_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ where
{
let is_picked = picked_pane == Some(pane);

content.on_event(
content.update(
tree,
event.clone(),
layout,
Expand Down
4 changes: 2 additions & 2 deletions widget/src/pane_grid/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ where
);
}

pub(crate) fn on_event(
pub(crate) fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand All @@ -254,7 +254,7 @@ where
let body_layout = if let Some(title_bar) = &mut self.title_bar {
let mut children = layout.children();

title_bar.on_event(
title_bar.update(
&mut tree.children[1],
event.clone(),
children.next().unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion widget/src/pane_grid/title_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ where
}
}

pub(crate) fn on_event(
pub(crate) fn update(
&mut self,
tree: &mut Tree,
event: Event,
Expand Down
7 changes: 3 additions & 4 deletions widget/src/themer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ where
);
}

fn on_event(
fn update(
&mut self,
event: Event,
layout: Layout<'_>,
Expand All @@ -227,9 +227,8 @@ where
clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
) {
self.content.on_event(
event, layout, cursor, renderer, clipboard, shell,
);
self.content
.update(event, layout, cursor, renderer, clipboard, shell);
}

fn operate(
Expand Down

0 comments on commit e5f1e31

Please sign in to comment.