Skip to content

Commit c0a7293

Browse files
committed
Fix alignment issues
1 parent ce3dfb3 commit c0a7293

1 file changed

Lines changed: 18 additions & 47 deletions

File tree

src/home/space_lobby.rs

Lines changed: 18 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,15 @@ live_design! {
197197
fn pixel(self) -> vec4 {
198198
let pos = self.pos * self.rect_size;
199199
let indent = self.indent_width;
200-
let half_indent = indent * 0.5;
200+
// Yes, this should be 0.5, but 0.6 makes it line up nicely
201+
// with the middle of the parent-level avatar, which is better.
202+
let half_indent = indent * 0.6;
201203
let line_width = 1.0;
202204
let half_line = 0.5;
203205

204206
let c = vec4(0.0);
205207

206-
// Iterate for parent levels and current level
208+
// Dumb approach, but it works.
207209
for i in 0..20 {
208210
if float(i) > self.level { break; }
209211

@@ -255,14 +257,14 @@ live_design! {
255257
}
256258
}
257259

258-
// Tree lines replace the spacer
260+
// The connecting hierarchical lines on the left.
259261
tree_lines = <TreeLines> {}
260262

261263
// Expand/collapse icon
262264
expand_icon = <IconRotated> {
263265
width: 16,
264266
height: 16,
265-
margin: { right: 4 }
267+
margin: { top: 7, left: -8, right: 2 }
266268
draw_icon: {
267269
svg_file: (ICON_COLLAPSE)
268270
rotation_angle: 90.0
@@ -271,15 +273,19 @@ live_design! {
271273
icon_walk: { width: 10, height: 10 }
272274
}
273275

274-
avatar = <Avatar> { width: 32, height: 32, margin: {right: 12} }
276+
avatar = <Avatar> { width: 32, height: 32, margin: {right: 8} }
275277

276278
content = <View> {
277-
width: Fill, height: Fit, flow: Down, spacing: 0,
279+
width: Fill, height: Fit, flow: Down, spacing: 5,
278280
name_label = <Label> {
281+
margin: 0
282+
padding: 0
279283
width: Fill, height: Fit,
280284
draw_text: { text_style: <REGULAR_TEXT>{font_size: 10.5}, color: #1a1a1a, wrap: Ellipsis }
281285
}
282286
info_label = <Label> {
287+
margin: 0
288+
padding: 0
283289
width: Fill, height: Fit,
284290
draw_text: { text_style: <REGULAR_TEXT>{font_size: 8.5}, color: #737373, wrap: Ellipsis }
285291
}
@@ -295,47 +301,12 @@ live_design! {
295301
}
296302

297303
// Entry for a child room (leaf node, no expand icon)
298-
pub RoomEntry = {{RoomEntry}} {
299-
width: Fill,
300-
height: 44,
301-
flow: Right,
302-
align: {y: 0.5}
303-
padding: {left: 8, right: 12}
304-
cursor: Hand
304+
pub RoomEntry = {{RoomEntry}}<SubspaceEntry> {
305+
cursor: Default
305306

306-
show_bg: true
307-
draw_bg: {
308-
instance hover: 0.0
309-
color: #fff
310-
uniform color_hover: #f5f5f5
311-
fn pixel(self) -> vec4 {
312-
return mix(self.color, self.color_hover, self.hover);
313-
}
314-
}
315-
316-
// Tree lines replace the spacer
317-
tree_lines = <TreeLines> {}
318-
319-
avatar = <Avatar> { width: 32, height: 32, margin: {right: 12} }
320-
321-
content = <View> {
322-
width: Fill, height: Fit, flow: Down, spacing: 0,
323-
name_label = <Label> {
324-
width: Fill, height: Fit,
325-
draw_text: { text_style: <REGULAR_TEXT>{font_size: 10.5}, color: #1a1a1a, wrap: Ellipsis }
326-
}
327-
info_label = <Label> {
328-
width: Fill, height: Fit,
329-
draw_text: { text_style: <REGULAR_TEXT>{font_size: 8.5}, color: #737373, wrap: Ellipsis }
330-
}
331-
}
332-
333-
animator: {
334-
hover = {
335-
default: off
336-
off = { from: {all: Forward {duration: 0.1}}, apply: { draw_bg: {hover: 0.0} } }
337-
on = { from: {all: Snap}, apply: { draw_bg: {hover: 1.0} } }
338-
}
307+
expand_icon = <View> {
308+
width: 10
309+
height: 16
339310
}
340311
}
341312

@@ -383,7 +354,7 @@ live_design! {
383354
height: 14,
384355
margin: {left: 8, right: 10}
385356
draw_bg: {
386-
color: #999
357+
color: (COLOR_ACTIVE_PRIMARY)
387358
border_size: 2.0,
388359
}
389360
}

0 commit comments

Comments
 (0)