diff options
author | 2020-07-23 04:44:35 +0200 | |
---|---|---|
committer | 2020-07-23 04:44:35 +0200 | |
commit | a165eddd757cb5d92d75febe1e5655c8077b76e5 (patch) | |
tree | 9877075c6be538846fccde110472d5ac452569f5 /native | |
parent | a225a218e010debb4bd32af09593b8929652b60f (diff) | |
download | iced-a165eddd757cb5d92d75febe1e5655c8077b76e5.tar.gz iced-a165eddd757cb5d92d75febe1e5655c8077b76e5.tar.bz2 iced-a165eddd757cb5d92d75febe1e5655c8077b76e5.zip |
Avoid `PaneGrid` unfocus when cursor is unavailable
Diffstat (limited to 'native')
-rw-r--r-- | native/src/widget/pane_grid.rs | 5 | ||||
-rw-r--r-- | native/src/widget/pick_list.rs | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/native/src/widget/pane_grid.rs b/native/src/widget/pane_grid.rs index dfff388b..5180fd3b 100644 --- a/native/src/widget/pane_grid.rs +++ b/native/src/widget/pane_grid.rs @@ -496,7 +496,10 @@ where } } } else { - self.state.unfocus(); + // TODO: Encode cursor availability in the type system + if cursor_position.x > 0.0 && cursor_position.y > 0.0 { + self.state.unfocus(); + } } } mouse::Event::ButtonReleased(mouse::Button::Left) => { diff --git a/native/src/widget/pick_list.rs b/native/src/widget/pick_list.rs index 3e83fa56..04478225 100644 --- a/native/src/widget/pick_list.rs +++ b/native/src/widget/pick_list.rs @@ -227,6 +227,7 @@ where match event { Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => { if *self.is_open { + // TODO: Encode cursor availability in the type system *self.is_open = cursor_position.x < 0.0 || cursor_position.y < 0.0; } else if layout.bounds().contains(cursor_position) { |