Fix context drawer when it is an overlay
This commit is contained in:
parent
ddb678ca69
commit
7d7c6fa71a
1 changed files with 45 additions and 24 deletions
|
|
@ -669,33 +669,54 @@ impl<App: Application> ApplicationExt for App {
|
||||||
widgets.push(horizontal_space(Length::Fixed(8.0)).into());
|
widgets.push(horizontal_space(Length::Fixed(8.0)).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
widgets.push(self.view().map(Message::App));
|
let main_content = self.view().map(Message::App);
|
||||||
|
|
||||||
if let Some(context) = self.context_drawer() {
|
//TODO: reduce duplication
|
||||||
widgets.push(
|
if core.window.context_is_overlay {
|
||||||
context_drawer(
|
if let Some(context) = self.context_drawer() {
|
||||||
&core.window.context_title,
|
widgets.push(
|
||||||
Message::Cosmic(cosmic::Message::ContextDrawer(false)),
|
context_drawer(
|
||||||
//TODO: this is a hack to allow toggling overlay
|
&core.window.context_title,
|
||||||
horizontal_space(if core.window.context_is_overlay {
|
Message::Cosmic(cosmic::Message::ContextDrawer(false)),
|
||||||
Length::Shrink
|
main_content,
|
||||||
} else {
|
context.map(Message::App),
|
||||||
//TODO: this width must be synced with the context drawer width
|
)
|
||||||
// Manual spacing must be used due to state workarounds below
|
.apply(|drawer| {
|
||||||
Length::Fixed(480.0 + 8.0)
|
Element::from(id_container(
|
||||||
|
drawer,
|
||||||
|
iced_core::id::Id::new("COSMIC_context_drawer"),
|
||||||
|
))
|
||||||
}),
|
}),
|
||||||
context.map(Message::App),
|
);
|
||||||
)
|
} else {
|
||||||
.apply(|drawer| {
|
widgets.push(main_content);
|
||||||
Element::from(id_container(
|
}
|
||||||
drawer,
|
|
||||||
iced_core::id::Id::new("COSMIC_context_drawer"),
|
|
||||||
))
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
//TODO: this element is added to workaround state issues
|
widgets.push(main_content);
|
||||||
widgets.push(horizontal_space(Length::Shrink).into());
|
if let Some(context) = self.context_drawer() {
|
||||||
|
widgets.push(
|
||||||
|
context_drawer(
|
||||||
|
&core.window.context_title,
|
||||||
|
Message::Cosmic(cosmic::Message::ContextDrawer(false)),
|
||||||
|
//TODO: this is a hack to allow toggling overlay
|
||||||
|
horizontal_space(
|
||||||
|
//TODO: this width must be synced with the context drawer width
|
||||||
|
// Manual spacing must be used due to state workarounds below
|
||||||
|
Length::Fixed(480.0 + 8.0),
|
||||||
|
),
|
||||||
|
context.map(Message::App),
|
||||||
|
)
|
||||||
|
.apply(|drawer| {
|
||||||
|
Element::from(id_container(
|
||||||
|
drawer,
|
||||||
|
iced_core::id::Id::new("COSMIC_context_drawer"),
|
||||||
|
))
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
//TODO: this element is added to workaround state issues
|
||||||
|
widgets.push(horizontal_space(Length::Shrink).into());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue