summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Matthew Kennerly <matthew.kennerly@lich.io>2022-08-27 06:19:44 +0800
committerLibravatar Matthew Kennerly <matthew.kennerly@lich.io>2022-08-27 06:25:12 +0800
commitea2df181477a605b8bcb5a7219d1e46a60c07d50 (patch)
treea4caaf8bfca5666878de1d6ae9e83d027ae3b637 /native
parent4158a9a0cdde28eeed49c24769497ddd86b6cb9a (diff)
downloadiced-ea2df181477a605b8bcb5a7219d1e46a60c07d50.tar.gz
iced-ea2df181477a605b8bcb5a7219d1e46a60c07d50.tar.bz2
iced-ea2df181477a605b8bcb5a7219d1e46a60c07d50.zip
When pane grid title bar is cramped, still show content until hover and allow dragging where content would've been
Diffstat (limited to 'native')
-rw-r--r--native/src/widget/pane_grid/title_bar.rs24
1 files changed, 15 insertions, 9 deletions
diff --git a/native/src/widget/pane_grid/title_bar.rs b/native/src/widget/pane_grid/title_bar.rs
index f9050e3e..eb85f924 100644
--- a/native/src/widget/pane_grid/title_bar.rs
+++ b/native/src/widget/pane_grid/title_bar.rs
@@ -144,14 +144,14 @@ where
let mut show_title = true;
if let Some(controls) = &self.controls {
- let controls_layout = children.next().unwrap();
- if title_layout.bounds().width + controls_layout.bounds().width
- > padded.bounds().width
- {
- show_title = false;
- }
-
if show_controls || self.always_show_controls {
+ let controls_layout = children.next().unwrap();
+ if title_layout.bounds().width + controls_layout.bounds().width
+ > padded.bounds().width
+ {
+ show_title = false;
+ }
+
controls.as_widget().draw(
&tree.children[1],
renderer,
@@ -195,8 +195,14 @@ where
if self.controls.is_some() {
let controls_layout = children.next().unwrap();
- !controls_layout.bounds().contains(cursor_position)
- && !title_layout.bounds().contains(cursor_position)
+ if title_layout.bounds().width + controls_layout.bounds().width
+ > padded.bounds().width
+ {
+ !controls_layout.bounds().contains(cursor_position)
+ } else {
+ !controls_layout.bounds().contains(cursor_position)
+ && !title_layout.bounds().contains(cursor_position)
+ }
} else {
!title_layout.bounds().contains(cursor_position)
}