Show NotAllowed as mouse icon when hovering a disabled TextInput
This commit is contained in:
parent
1de794aabf
commit
7e7e66586d
3 changed files with 9 additions and 2 deletions
|
|
@ -12,4 +12,5 @@ pub enum Interaction {
|
|||
Grabbing,
|
||||
ResizingHorizontally,
|
||||
ResizingVertically,
|
||||
NotAllowed,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ where
|
|||
_viewport: &Rectangle,
|
||||
_renderer: &Renderer,
|
||||
) -> mouse::Interaction {
|
||||
mouse_interaction(layout, cursor_position)
|
||||
mouse_interaction(layout, cursor_position, self.on_input.is_none())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1117,9 +1117,14 @@ pub fn draw<Renderer>(
|
|||
pub fn mouse_interaction(
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
is_disabled: bool,
|
||||
) -> mouse::Interaction {
|
||||
if layout.bounds().contains(cursor_position) {
|
||||
mouse::Interaction::Text
|
||||
if is_disabled {
|
||||
mouse::Interaction::NotAllowed
|
||||
} else {
|
||||
mouse::Interaction::Text
|
||||
}
|
||||
} else {
|
||||
mouse::Interaction::default()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,6 +236,7 @@ pub fn mouse_interaction(
|
|||
winit::window::CursorIcon::EwResize
|
||||
}
|
||||
Interaction::ResizingVertically => winit::window::CursorIcon::NsResize,
|
||||
Interaction::NotAllowed => winit::window::CursorIcon::NotAllowed,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue