pub enum ScrollCacheExtent {
Pixels(f64),
Viewport(f64),
}Expand description
The amount of additional content to display and lay out around the viewport.
The cache area is used to lay out slivers before they are visible on screen. Items that fall in this cache area are laid out even though they are not visible on screen. This allows the viewport to render them ahead of time, enabling a smoother scrolling experience.
This type encapsulates both the value and the style of the cache extent. It allows the cache
extent to be defined either as a fixed number of logical pixels using
ScrollCacheExtent::Pixels or as a multiplier of the viewport’s main axis extent using
ScrollCacheExtent::Viewport.
Variants§
Pixels(f64)
A cache extent in logical pixels.
Viewport(f64)
A cache extent as a multiplier of the viewport’s main axis extent.
The main axis extent is the size of the viewport in its main axis. For example, for a
vertically scrolling list, the main axis extent is the height of the viewport. If the
viewport is 600 logical pixels tall, then ScrollCacheExtent::Viewport(2.0) results in a
cache extent of 1200 logical pixels.
Implementations§
Source§impl ScrollCacheExtent
impl ScrollCacheExtent
Sourcepub fn style(self) -> CacheExtentStyle
pub fn style(self) -> CacheExtentStyle
Returns the style of the cache extent.
Sourcepub fn value(self) -> f64
pub fn value(self) -> f64
Returns the raw value of the cache extent.
If style is CacheExtentStyle::Pixel, this is the number of pixels to
cache. If it is CacheExtentStyle::Viewport, this is the multiplier of the viewport’s
main axis extent to cache.