dock: Hide toggle button when side dock is not exist. (#431)
This commit is contained in:
parent
d937a90db6
commit
ea011d11d6
4 changed files with 14 additions and 6 deletions
|
|
@ -296,7 +296,7 @@ impl Render for Dock {
|
||||||
})
|
})
|
||||||
// Bottom Dock should keep the title bar, then user can click the Toggle button
|
// Bottom Dock should keep the title bar, then user can click the Toggle button
|
||||||
.when(!self.open && self.placement.is_bottom(), |this| {
|
.when(!self.open && self.placement.is_bottom(), |this| {
|
||||||
this.h(px(30.))
|
this.h(px(29.))
|
||||||
})
|
})
|
||||||
.map(|this| match &self.panel {
|
.map(|this| match &self.panel {
|
||||||
DockItem::Split { view, .. } => this.child(view.clone()),
|
DockItem::Split { view, .. } => this.child(view.clone()),
|
||||||
|
|
|
||||||
|
|
@ -385,13 +385,21 @@ impl TabPanel {
|
||||||
|
|
||||||
let view_entity_id = cx.view().entity_id();
|
let view_entity_id = cx.view().entity_id();
|
||||||
let dock_area = self.dock_area.upgrade()?.read(cx);
|
let dock_area = self.dock_area.upgrade()?.read(cx);
|
||||||
|
|
||||||
let toggle_button_panels = dock_area.toggle_button_panels;
|
let toggle_button_panels = dock_area.toggle_button_panels;
|
||||||
|
|
||||||
// Check if current TabPanel's entity_id matches the one stored in DockArea for this placement
|
// Check if current TabPanel's entity_id matches the one stored in DockArea for this placement
|
||||||
if !match placement {
|
if !match placement {
|
||||||
DockPlacement::Left => toggle_button_panels.left == Some(view_entity_id),
|
DockPlacement::Left => {
|
||||||
DockPlacement::Right => toggle_button_panels.right == Some(view_entity_id),
|
dock_area.left_dock.is_some() && toggle_button_panels.left == Some(view_entity_id)
|
||||||
DockPlacement::Bottom => toggle_button_panels.bottom == Some(view_entity_id),
|
}
|
||||||
|
DockPlacement::Right => {
|
||||||
|
dock_area.right_dock.is_some() && toggle_button_panels.right == Some(view_entity_id)
|
||||||
|
}
|
||||||
|
DockPlacement::Bottom => {
|
||||||
|
dock_area.bottom_dock.is_some()
|
||||||
|
&& toggle_button_panels.bottom == Some(view_entity_id)
|
||||||
|
}
|
||||||
} {
|
} {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ impl Element for ScrollableMask {
|
||||||
bounds,
|
bounds,
|
||||||
border_widths: Edges::all(px(1.0)),
|
border_widths: Edges::all(px(1.0)),
|
||||||
border_color: color,
|
border_color: color,
|
||||||
background: gpui::transparent_white().into(),
|
background: gpui::transparent_white(),
|
||||||
corner_radii: Corners::all(px(0.)),
|
corner_radii: Corners::all(px(0.)),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -460,7 +460,7 @@ impl Element for Scrollbar {
|
||||||
cx.paint_quad(PaintQuad {
|
cx.paint_quad(PaintQuad {
|
||||||
bounds,
|
bounds,
|
||||||
corner_radii: (0.).into(),
|
corner_radii: (0.).into(),
|
||||||
background: gpui::transparent_black().into(),
|
background: gpui::transparent_black(),
|
||||||
border_widths: if is_vertical {
|
border_widths: if is_vertical {
|
||||||
Edges {
|
Edges {
|
||||||
top: px(0.),
|
top: px(0.),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue