collab panel: Make screen share row line up with shared projects
Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
e0bdd857f1
commit
123bc85a8e
1 changed files with 12 additions and 47 deletions
|
@ -1106,23 +1106,17 @@ impl CollabPanel {
|
||||||
) -> AnyElement<Self> {
|
) -> AnyElement<Self> {
|
||||||
enum OpenSharedScreen {}
|
enum OpenSharedScreen {}
|
||||||
|
|
||||||
let font_cache = cx.font_cache();
|
let host_avatar_width = theme
|
||||||
let host_avatar_height = theme
|
|
||||||
.contact_avatar
|
.contact_avatar
|
||||||
.width
|
.width
|
||||||
.or(theme.contact_avatar.height)
|
.or(theme.contact_avatar.height)
|
||||||
.unwrap_or(0.);
|
.unwrap_or(0.);
|
||||||
let row = &theme.project_row.inactive_state().default;
|
|
||||||
let tree_branch = theme.tree_branch;
|
let tree_branch = theme.tree_branch;
|
||||||
let line_height = row.name.text.line_height(font_cache);
|
|
||||||
let cap_height = row.name.text.cap_height(font_cache);
|
|
||||||
let baseline_offset =
|
|
||||||
row.name.text.baseline_offset(font_cache) + (theme.row_height - line_height) / 2.;
|
|
||||||
|
|
||||||
MouseEventHandler::new::<OpenSharedScreen, _>(
|
MouseEventHandler::new::<OpenSharedScreen, _>(
|
||||||
peer_id.as_u64() as usize,
|
peer_id.as_u64() as usize,
|
||||||
cx,
|
cx,
|
||||||
|mouse_state, _| {
|
|mouse_state, cx| {
|
||||||
let tree_branch = *tree_branch.in_state(is_selected).style_for(mouse_state);
|
let tree_branch = *tree_branch.in_state(is_selected).style_for(mouse_state);
|
||||||
let row = theme
|
let row = theme
|
||||||
.project_row
|
.project_row
|
||||||
|
@ -1130,49 +1124,20 @@ impl CollabPanel {
|
||||||
.style_for(mouse_state);
|
.style_for(mouse_state);
|
||||||
|
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.with_child(
|
.with_child(render_tree_branch(
|
||||||
Stack::new()
|
tree_branch,
|
||||||
.with_child(Canvas::new(move |scene, bounds, _, _, _| {
|
&row.name.text,
|
||||||
let start_x = bounds.min_x() + (bounds.width() / 2.)
|
is_last,
|
||||||
- (tree_branch.width / 2.);
|
vec2f(host_avatar_width, theme.row_height),
|
||||||
let end_x = bounds.max_x();
|
cx.font_cache(),
|
||||||
let start_y = bounds.min_y();
|
))
|
||||||
let end_y = bounds.min_y() + baseline_offset - (cap_height / 2.);
|
|
||||||
|
|
||||||
scene.push_quad(gpui::Quad {
|
|
||||||
bounds: RectF::from_points(
|
|
||||||
vec2f(start_x, start_y),
|
|
||||||
vec2f(
|
|
||||||
start_x + tree_branch.width,
|
|
||||||
if is_last { end_y } else { bounds.max_y() },
|
|
||||||
),
|
|
||||||
),
|
|
||||||
background: Some(tree_branch.color),
|
|
||||||
border: gpui::Border::default(),
|
|
||||||
corner_radii: (0.).into(),
|
|
||||||
});
|
|
||||||
scene.push_quad(gpui::Quad {
|
|
||||||
bounds: RectF::from_points(
|
|
||||||
vec2f(start_x, end_y),
|
|
||||||
vec2f(end_x, end_y + tree_branch.width),
|
|
||||||
),
|
|
||||||
background: Some(tree_branch.color),
|
|
||||||
border: gpui::Border::default(),
|
|
||||||
corner_radii: (0.).into(),
|
|
||||||
});
|
|
||||||
}))
|
|
||||||
.constrained()
|
|
||||||
.with_width(host_avatar_height),
|
|
||||||
)
|
|
||||||
.with_child(
|
.with_child(
|
||||||
Svg::new("icons/disable_screen_sharing_12.svg")
|
Svg::new("icons/disable_screen_sharing_12.svg")
|
||||||
.with_color(row.icon.color)
|
.with_color(theme.channel_hash.color)
|
||||||
.constrained()
|
.constrained()
|
||||||
.with_width(row.icon.width)
|
.with_width(theme.channel_hash.width)
|
||||||
.aligned()
|
.aligned()
|
||||||
.left()
|
.left(),
|
||||||
.contained()
|
|
||||||
.with_style(row.icon.container),
|
|
||||||
)
|
)
|
||||||
.with_child(
|
.with_child(
|
||||||
Label::new("Screen", row.name.text.clone())
|
Label::new("Screen", row.name.text.clone())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue