summaryrefslogtreecommitdiffstats
path: root/widget/src/mouse_area.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-07 12:02:56 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-07 12:02:56 +0100
commitfef6fca369a5197e90742c03a60122952dd3e645 (patch)
tree4779b850fe8d42cedd0a8f99dc38a9fc9861137c /widget/src/mouse_area.rs
parentd756a9210acd97eb41191f5199f4d7357f4d253a (diff)
downloadiced-fef6fca369a5197e90742c03a60122952dd3e645.tar.gz
iced-fef6fca369a5197e90742c03a60122952dd3e645.tar.bz2
iced-fef6fca369a5197e90742c03a60122952dd3e645.zip
Shorten some `MouseArea` methods
Diffstat (limited to 'widget/src/mouse_area.rs')
-rw-r--r--widget/src/mouse_area.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/widget/src/mouse_area.rs b/widget/src/mouse_area.rs
index c9258c40..63a8ae89 100644
--- a/widget/src/mouse_area.rs
+++ b/widget/src/mouse_area.rs
@@ -79,14 +79,14 @@ impl<'a, Message, Theme, Renderer> MouseArea<'a, Message, Theme, Renderer> {
/// The message to emit when the mouse enters the area.
#[must_use]
- pub fn on_mouse_enter(mut self, message: Message) -> Self {
+ pub fn on_enter(mut self, message: Message) -> Self {
self.on_mouse_enter = Some(message);
self
}
/// The message to emit when the mouse moves in the area.
#[must_use]
- pub fn on_mouse_move<F>(mut self, build_message: F) -> Self
+ pub fn on_move<F>(mut self, build_message: F) -> Self
where
F: Fn(Point) -> Message + 'static,
{
@@ -96,17 +96,14 @@ impl<'a, Message, Theme, Renderer> MouseArea<'a, Message, Theme, Renderer> {
/// The message to emit when the mouse exits the area.
#[must_use]
- pub fn on_mouse_exit(mut self, message: Message) -> Self {
+ pub fn on_exit(mut self, message: Message) -> Self {
self.on_mouse_exit = Some(message);
self
}
/// The [`mouse::Interaction`] to use when hovering the area.
#[must_use]
- pub fn mouse_interaction(
- mut self,
- interaction: mouse::Interaction,
- ) -> Self {
+ pub fn interaction(mut self, interaction: mouse::Interaction) -> Self {
self.interaction = Some(interaction);
self
}