fix(window): round corners based on header
This commit is contained in:
parent
cb51f2d30a
commit
20d5290145
3 changed files with 33 additions and 21 deletions
|
|
@ -50,6 +50,7 @@ pub struct TerminalBox<'a, Message> {
|
|||
id: Option<Id>,
|
||||
border: Border,
|
||||
padding: Padding,
|
||||
show_headerbar: bool,
|
||||
click_timing: Duration,
|
||||
context_menu: Option<Point>,
|
||||
on_context_menu: Option<Box<dyn Fn(Option<Point>) -> Message + 'a>>,
|
||||
|
|
@ -70,6 +71,7 @@ where
|
|||
id: None,
|
||||
border: Border::default(),
|
||||
padding: Padding::new(0.0),
|
||||
show_headerbar: true,
|
||||
click_timing: Duration::from_millis(500),
|
||||
context_menu: None,
|
||||
on_context_menu: None,
|
||||
|
|
@ -96,6 +98,11 @@ where
|
|||
self
|
||||
}
|
||||
|
||||
pub fn show_headerbar(mut self, show_headerbar: bool) -> Self {
|
||||
self.show_headerbar = show_headerbar;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn click_timing(mut self, click_timing: Duration) -> Self {
|
||||
self.click_timing = click_timing;
|
||||
self
|
||||
|
|
@ -281,7 +288,11 @@ where
|
|||
Quad {
|
||||
bounds: layout.bounds(),
|
||||
border: Border {
|
||||
radius: [0.0, 0.0, radius_s, radius_s].into(),
|
||||
radius: if self.show_headerbar {
|
||||
[0.0, 0.0, radius_s, radius_s].into()
|
||||
} else {
|
||||
[radius_s, radius_s, radius_s, radius_s].into()
|
||||
},
|
||||
width: self.border.width,
|
||||
color: self.border.color,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue