When pane grid title bar is cramped, still show content until hover and allow dragging where content would've been

This commit is contained in:
Matthew Kennerly 2022-08-27 06:19:44 +08:00
parent 4158a9a0cd
commit ea2df18147
No known key found for this signature in database
GPG key ID: CC3C3CA07623ED74

View file

@ -144,6 +144,7 @@ where
let mut show_title = true; let mut show_title = true;
if let Some(controls) = &self.controls { if let Some(controls) = &self.controls {
if show_controls || self.always_show_controls {
let controls_layout = children.next().unwrap(); let controls_layout = children.next().unwrap();
if title_layout.bounds().width + controls_layout.bounds().width if title_layout.bounds().width + controls_layout.bounds().width
> padded.bounds().width > padded.bounds().width
@ -151,7 +152,6 @@ where
show_title = false; show_title = false;
} }
if show_controls || self.always_show_controls {
controls.as_widget().draw( controls.as_widget().draw(
&tree.children[1], &tree.children[1],
renderer, renderer,
@ -195,8 +195,14 @@ where
if self.controls.is_some() { if self.controls.is_some() {
let controls_layout = children.next().unwrap(); let controls_layout = children.next().unwrap();
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) !controls_layout.bounds().contains(cursor_position)
&& !title_layout.bounds().contains(cursor_position) && !title_layout.bounds().contains(cursor_position)
}
} else { } else {
!title_layout.bounds().contains(cursor_position) !title_layout.bounds().contains(cursor_position)
} }