fix: menu folder corners
This commit is contained in:
parent
cad4be9401
commit
a365d45091
2 changed files with 18 additions and 2 deletions
|
|
@ -472,7 +472,10 @@ impl<'a, Message: 'a + Clone> Widget<Message, crate::Theme, crate::Renderer>
|
||||||
|
|
||||||
theme.active(state.is_focused, self.selected, &self.style)
|
theme.active(state.is_focused, self.selected, &self.style)
|
||||||
};
|
};
|
||||||
if matches!(self.style, crate::theme::Button::MenuItem) {
|
if matches!(
|
||||||
|
self.style,
|
||||||
|
crate::theme::Button::MenuItem | crate::theme::Button::MenuFolder
|
||||||
|
) {
|
||||||
match theme.list_item_position {
|
match theme.list_item_position {
|
||||||
Some((Alignment::Start, _)) => {
|
Some((Alignment::Start, _)) => {
|
||||||
styling.border_radius =
|
styling.border_radius =
|
||||||
|
|
|
||||||
|
|
@ -818,13 +818,26 @@ impl<'b, Message: Clone + 'static> Menu<'b, Message> {
|
||||||
.children()
|
.children()
|
||||||
.nth(active.saturating_sub(start_index))
|
.nth(active.saturating_sub(start_index))
|
||||||
{
|
{
|
||||||
|
let i = active.saturating_sub(start_index);
|
||||||
|
let mut rad = styling.menu_border_radius;
|
||||||
|
let rad_0 = theme.cosmic().radius_0();
|
||||||
|
if start_index == end_index {
|
||||||
|
} else if 0 == i {
|
||||||
|
rad[0] = rad_0[0];
|
||||||
|
rad[1] = rad_0[1];
|
||||||
|
} else if i == end_index - start_index {
|
||||||
|
rad[2] = rad_0[2];
|
||||||
|
rad[3] = rad_0[3];
|
||||||
|
} else {
|
||||||
|
rad = rad_0;
|
||||||
|
}
|
||||||
let path_quad = renderer::Quad {
|
let path_quad = renderer::Quad {
|
||||||
bounds: active_layout
|
bounds: active_layout
|
||||||
.bounds()
|
.bounds()
|
||||||
.intersection(&viewport)
|
.intersection(&viewport)
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
border: Border {
|
border: Border {
|
||||||
radius: styling.menu_border_radius.into(),
|
radius: rad.into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
shadow: Shadow::default(),
|
shadow: Shadow::default(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue