fix: reset text_input focus when clicked outside
This commit is contained in:
parent
60817451bb
commit
8ba2185f43
1 changed files with 11 additions and 4 deletions
|
|
@ -1429,13 +1429,12 @@ where
|
||||||
|
|
||||||
return event::Status::Captured;
|
return event::Status::Captured;
|
||||||
}
|
}
|
||||||
|
let mut is_trailing_clicked = false;
|
||||||
if is_editable {
|
if is_editable {
|
||||||
if let Some(trailing_layout) = trailing_icon_layout {
|
if let Some(trailing_layout) = trailing_icon_layout {
|
||||||
let is_trailing_clicked =
|
is_trailing_clicked = cursor.is_over(trailing_layout.bounds());
|
||||||
cursor.is_over(trailing_layout.bounds()) && on_toggle_edit.is_some();
|
|
||||||
|
|
||||||
if is_trailing_clicked {
|
if is_trailing_clicked && on_toggle_edit.is_some() {
|
||||||
let Some(pos) = cursor.position() else {
|
let Some(pos) = cursor.position() else {
|
||||||
return event::Status::Ignored;
|
return event::Status::Ignored;
|
||||||
};
|
};
|
||||||
|
|
@ -1472,6 +1471,14 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !is_trailing_clicked && click_position.is_none() {
|
||||||
|
state.is_focused = None;
|
||||||
|
state.dragging_state = None;
|
||||||
|
state.is_pasting = None;
|
||||||
|
|
||||||
|
state.keyboard_modifiers = keyboard::Modifiers::default();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
|
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
|
||||||
| Event::Touch(touch::Event::FingerLifted { .. } | touch::Event::FingerLost { .. }) => {
|
| Event::Touch(touch::Event::FingerLifted { .. } | touch::Event::FingerLost { .. }) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue