fix(headerbar): handle zero length segments
This commit is contained in:
parent
aaa4b83577
commit
50367b96e3
2 changed files with 4 additions and 4 deletions
|
|
@ -452,11 +452,11 @@ where
|
||||||
if let Some(v) = self.surface_views.get(&id) {
|
if let Some(v) = self.surface_views.get(&id) {
|
||||||
return v(&self.app);
|
return v(&self.app);
|
||||||
}
|
}
|
||||||
if !self
|
if self
|
||||||
.app
|
.app
|
||||||
.core()
|
.core()
|
||||||
.main_window_id()
|
.main_window_id()
|
||||||
.is_some_and(|main_id| main_id == id)
|
.is_none_or(|main_id| main_id != id)
|
||||||
{
|
{
|
||||||
return self.app.view_window(id).map(crate::Action::App);
|
return self.app.view_window(id).map(crate::Action::App);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -356,9 +356,9 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
|
||||||
if center.is_empty() && (self.title.is_empty() || self.is_condensed) {
|
if center.is_empty() && (self.title.is_empty() || self.is_condensed) {
|
||||||
let left_to_right_ratio = left_len as f32 / right_len.max(1) as f32;
|
let left_to_right_ratio = left_len as f32 / right_len.max(1) as f32;
|
||||||
let right_to_left_ratio = right_len as f32 / left_len.max(1) as f32;
|
let right_to_left_ratio = right_len as f32 / left_len.max(1) as f32;
|
||||||
if right_to_left_ratio > 2. {
|
if right_to_left_ratio > 2. || left_len < 1 {
|
||||||
(1, 2)
|
(1, 2)
|
||||||
} else if left_to_right_ratio > 2. {
|
} else if left_to_right_ratio > 2. || right_len < 1 {
|
||||||
(2, 1)
|
(2, 1)
|
||||||
} else {
|
} else {
|
||||||
(left_len as u16, (right_len + window_control_cnt) as u16)
|
(left_len as u16, (right_len + window_control_cnt) as u16)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue