project panel: Add indent guides for sticky items (#34092)
- Adds new trait `StickyItemsDecoration` in `sticky_items` which is implemented by `IndentGuides` from `indent_guides`. <img width="347" alt="image" src="https://github.com/user-attachments/assets/577748bc-13f6-41b8-9266-6a0b72349a18" /> Release Notes: - N/A
This commit is contained in:
parent
ad8b823555
commit
3a247ee947
6 changed files with 580 additions and 400 deletions
|
@ -55,23 +55,27 @@ impl Render for IndentGuidesStory {
|
|||
}),
|
||||
)
|
||||
.with_sizing_behavior(gpui::ListSizingBehavior::Infer)
|
||||
.with_decoration(ui::indent_guides(
|
||||
cx.entity().clone(),
|
||||
px(16.),
|
||||
ui::IndentGuideColors {
|
||||
default: Color::Info.color(cx),
|
||||
hover: Color::Accent.color(cx),
|
||||
active: Color::Accent.color(cx),
|
||||
},
|
||||
|this, range, _cx, _context| {
|
||||
this.depths
|
||||
.iter()
|
||||
.skip(range.start)
|
||||
.take(range.end - range.start)
|
||||
.cloned()
|
||||
.collect()
|
||||
},
|
||||
)),
|
||||
.with_decoration(
|
||||
ui::indent_guides(
|
||||
px(16.),
|
||||
ui::IndentGuideColors {
|
||||
default: Color::Info.color(cx),
|
||||
hover: Color::Accent.color(cx),
|
||||
active: Color::Accent.color(cx),
|
||||
},
|
||||
)
|
||||
.with_compute_indents_fn(
|
||||
cx.entity().clone(),
|
||||
|this, range, _cx, _context| {
|
||||
this.depths
|
||||
.iter()
|
||||
.skip(range.start)
|
||||
.take(range.end - range.start)
|
||||
.cloned()
|
||||
.collect()
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue