Reveal item even if project panel was closed while active entry changed

The project panel was actually working just fine, the problem was due to
`UniformList` not re-hydrating the element state's scroll offset when
being rendered again.
This commit is contained in:
Antonio Scandurra
2023-12-22 14:39:16 +01:00
parent c1ad079f09
commit 68cf631cfc

View File

@@ -190,7 +190,15 @@ impl Element for UniformList {
let shared_scroll_offset = element_state
.interactive
.scroll_offset
.get_or_insert_with(Rc::default)
.get_or_insert_with(|| {
if let Some(scroll_handle) = self.scroll_handle.as_ref() {
if let Some(scroll_handle) = scroll_handle.0.borrow().as_ref() {
return scroll_handle.scroll_offset.clone();
}
}
Rc::default()
})
.clone();
let item_height = self.measure_item(Some(padded_bounds.size.width), cx).height;