Draft draggable and graphics logic for TitleBar
This commit is contained in:
parent
e8e656b330
commit
4dc5bffdfb
7 changed files with 268 additions and 73 deletions
|
|
@ -39,20 +39,10 @@ where
|
|||
let (content, mouse_interaction) =
|
||||
content.draw(self, &defaults, content_layout, cursor_position);
|
||||
|
||||
if style.background.is_some() || style.border_width > 0 {
|
||||
let quad = Primitive::Quad {
|
||||
bounds,
|
||||
background: style
|
||||
.background
|
||||
.unwrap_or(Background::Color(Color::TRANSPARENT)),
|
||||
border_radius: style.border_radius,
|
||||
border_width: style.border_width,
|
||||
border_color: style.border_color,
|
||||
};
|
||||
|
||||
if let Some(background) = background(bounds, &style) {
|
||||
(
|
||||
Primitive::Group {
|
||||
primitives: vec![quad, content],
|
||||
primitives: vec![background, content],
|
||||
},
|
||||
mouse_interaction,
|
||||
)
|
||||
|
|
@ -61,3 +51,22 @@ where
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn background(
|
||||
bounds: Rectangle,
|
||||
style: &container::Style,
|
||||
) -> Option<Primitive> {
|
||||
if style.background.is_none() && style.border_width > 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(Primitive::Quad {
|
||||
bounds,
|
||||
background: style
|
||||
.background
|
||||
.unwrap_or(Background::Color(Color::TRANSPARENT)),
|
||||
border_radius: style.border_radius,
|
||||
border_width: style.border_width,
|
||||
border_color: style.border_color,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue