title_bar: Fix pl to override default TitleBar left padding. (#944)
This commit is contained in:
parent
a7505487e1
commit
f82c347e37
1 changed files with 8 additions and 6 deletions
|
|
@ -27,7 +27,7 @@ pub struct TitleBar {
|
||||||
impl TitleBar {
|
impl TitleBar {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
base: div().id("title-bar"),
|
base: div().id("title-bar").pl(TITLE_BAR_LEFT_PADDING),
|
||||||
children: Vec::new(),
|
children: Vec::new(),
|
||||||
on_close_window: None,
|
on_close_window: None,
|
||||||
}
|
}
|
||||||
|
|
@ -243,10 +243,12 @@ impl ParentElement for TitleBar {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RenderOnce for TitleBar {
|
impl RenderOnce for TitleBar {
|
||||||
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement {
|
fn render(mut self, window: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||||
let is_linux = cfg!(target_os = "linux");
|
let is_linux = cfg!(target_os = "linux");
|
||||||
|
|
||||||
const HEIGHT: Pixels = px(34.);
|
let paddings = self.base.style().padding.clone();
|
||||||
|
self.base.style().padding.left = None;
|
||||||
|
let left_padding = paddings.left.unwrap_or(TITLE_BAR_LEFT_PADDING.into());
|
||||||
|
|
||||||
div().flex_shrink_0().child(
|
div().flex_shrink_0().child(
|
||||||
self.base
|
self.base
|
||||||
|
|
@ -254,7 +256,7 @@ impl RenderOnce for TitleBar {
|
||||||
.flex_row()
|
.flex_row()
|
||||||
.items_center()
|
.items_center()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.h(HEIGHT)
|
.h(TITLE_BAR_HEIGHT)
|
||||||
.border_b_1()
|
.border_b_1()
|
||||||
.border_color(cx.theme().title_bar_border)
|
.border_color(cx.theme().title_bar_border)
|
||||||
.bg(cx.theme().title_bar)
|
.bg(cx.theme().title_bar)
|
||||||
|
|
@ -264,8 +266,8 @@ impl RenderOnce for TitleBar {
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
.id("bar")
|
.id("bar")
|
||||||
.pl(TITLE_BAR_LEFT_PADDING)
|
.pl(left_padding)
|
||||||
.when(window.is_fullscreen(), |this| this.pl(px(12.)))
|
.when(window.is_fullscreen(), |this| this.pl_3())
|
||||||
.window_control_area(WindowControlArea::Drag)
|
.window_control_area(WindowControlArea::Drag)
|
||||||
.h_full()
|
.h_full()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue