pub struct VirtualList { /* private fields */ }Expand description
Virtual list widget for egui.
Implementations§
Source§impl VirtualList
impl VirtualList
Sourcepub fn items_inserted_at_start(&mut self, scroll_top_items: usize)
pub fn items_inserted_at_start(&mut self, scroll_top_items: usize)
Call this when you insert items at the start of the list. The list will offset the scroll position by the height of these items, so that for the user, the scroll position stays the same.
Sourcepub fn over_scan(&mut self, over_scan: f32)
pub fn over_scan(&mut self, over_scan: f32)
Set the overscan, or how much the list should render outside of the visible area. The default is 200.0.
Sourcepub fn check_for_resize(&mut self, check_for_resize: bool)
pub fn check_for_resize(&mut self, check_for_resize: bool)
Checks if the list was resized and resets the cached sizes if it was. If you are certain that the item heights won’t change on resize, you can disable this. The default is true.
Sourcepub fn scroll_position_sync_on_resize(
&mut self,
scroll_position_sync_on_resize: bool,
)
pub fn scroll_position_sync_on_resize( &mut self, scroll_position_sync_on_resize: bool, )
Tries to keep the first visible item at the top of the screen when the window is resized. Depending on the contents, this may cause some flicker. The default is true.
Sourcepub fn hide_on_resize(&mut self, hide_on_resize: impl Into<Option<Duration>>)
pub fn hide_on_resize(&mut self, hide_on_resize: impl Into<Option<Duration>>)
Prevent flickering while resizing by hiding the list until the resize is done. The default is true.
Sourcepub fn ui_custom_layout(
&mut self,
ui: &mut Ui,
length: usize,
layout: impl FnMut(&mut Ui, usize) -> usize,
) -> VirtualListResponse
pub fn ui_custom_layout( &mut self, ui: &mut Ui, length: usize, layout: impl FnMut(&mut Ui, usize) -> usize, ) -> VirtualListResponse
The layout closure gets called for each row with the index of the first item that should be displayed. It should return the number of items that were displayed in the row.