virtual_list: Try to use second item to measure. (#504)
This commit is contained in:
parent
1a4ee348f8
commit
2f4b7a3eca
1 changed files with 4 additions and 1 deletions
|
|
@ -133,7 +133,10 @@ impl VirtualList {
|
|||
return Size::default();
|
||||
}
|
||||
|
||||
let item_ix = 0;
|
||||
// Avoid use first item to measure, because in most cases, this first item many complex.
|
||||
// So we try to use the second item to measure, if there is no second item, use the first item.
|
||||
let item_ix = if self.items_count > 1 { 1 } else { 0 };
|
||||
|
||||
let mut items = (self.render_items)(item_ix..item_ix + 1, Size::default(), cx);
|
||||
let Some(mut item_to_measure) = items.pop() else {
|
||||
return Size::default();
|
||||
|
|
|
|||
Loading…
Reference in a new issue