pub(in compute::grid) struct GridTrack {
pub kind: GridTrackKind,
pub is_collapsed: bool,
pub min_track_sizing_function: MinTrackSizingFunction,
pub max_track_sizing_function: MaxTrackSizingFunction,
pub offset: f32,
pub base_size: f32,
pub growth_limit: f32,
pub content_alignment_adjustment: f32,
pub item_incurred_increase: f32,
pub base_size_planned_increase: f32,
pub growth_limit_planned_increase: f32,
pub infinitely_growable: bool,
}
Expand description
Internal sizing information for a single grid track (row/column) Gutters between tracks are sized similarly to actual tracks, so they are also represented by this struct
Fields§
§kind: GridTrackKind
Whether the track is a full track, a gutter, or a placeholder that has not yet been initialised
is_collapsed: bool
Whether the track is a collapsed track/gutter. Collapsed tracks are effectively treated as if they don’t exist for the purposes of grid sizing. Gutters between collapsed tracks are also collapsed.
min_track_sizing_function: MinTrackSizingFunction
The minimum track sizing function of the track
max_track_sizing_function: MaxTrackSizingFunction
The maximum track sizing function of the track
offset: f32
The distance of the start of the track from the start of the grid container
base_size: f32
The size (width/height as applicable) of the track
growth_limit: f32
A temporary scratch value when sizing tracks Note: can be infinity
content_alignment_adjustment: f32
A temporary scratch value when sizing tracks. Is used as an additional amount to add to the estimate for the available space in the opposite axis when content sizing items
item_incurred_increase: f32
A temporary scratch value when “distributing space” to avoid clobbering planned increase variable
base_size_planned_increase: f32
A temporary scratch value when “distributing space” to avoid clobbering the main variable
growth_limit_planned_increase: f32
A temporary scratch value when “distributing space” to avoid clobbering the main variable
infinitely_growable: bool
A temporary scratch value when “distributing space” See: https://www.w3.org/TR/css3-grid-layout/#infinitely-growable
Implementations§
Source§impl GridTrack
impl GridTrack
Sourcefn new_with_kind(
kind: GridTrackKind,
min_track_sizing_function: MinTrackSizingFunction,
max_track_sizing_function: MaxTrackSizingFunction,
) -> GridTrack
fn new_with_kind( kind: GridTrackKind, min_track_sizing_function: MinTrackSizingFunction, max_track_sizing_function: MaxTrackSizingFunction, ) -> GridTrack
GridTrack constructor with all configuration parameters for the other constructors exposed
Sourcepub fn new(
min_track_sizing_function: MinTrackSizingFunction,
max_track_sizing_function: MaxTrackSizingFunction,
) -> GridTrack
pub fn new( min_track_sizing_function: MinTrackSizingFunction, max_track_sizing_function: MaxTrackSizingFunction, ) -> GridTrack
Create new GridTrack representing an actual track (not a gutter)
Sourcepub fn gutter(size: LengthPercentage) -> GridTrack
pub fn gutter(size: LengthPercentage) -> GridTrack
Create a new GridTrack representing a gutter
Sourcepub fn collapse(&mut self)
pub fn collapse(&mut self)
Mark a GridTrack as collapsed. Also sets both of the track’s sizing functions to fixed zero-sized sizing functions.
Sourcepub fn is_flexible(&self) -> bool
pub fn is_flexible(&self) -> bool
Returns true if the track is flexible (has a Flex MaxTrackSizingFunction), else false.
Sourcepub fn uses_percentage(&self) -> bool
pub fn uses_percentage(&self) -> bool
Returns true if the track is flexible (has a Flex MaxTrackSizingFunction), else false.
Sourcepub fn has_intrinsic_sizing_function(&self) -> bool
pub fn has_intrinsic_sizing_function(&self) -> bool
Returns true if the track has an intrinsic min and or max sizing function
Sourcepub fn fit_content_limit(&self, axis_available_grid_space: Option<f32>) -> f32
pub fn fit_content_limit(&self, axis_available_grid_space: Option<f32>) -> f32
Returns true if the track is flexible (has a Flex MaxTrackSizingFunction), else false.
Sourcepub fn fit_content_limited_growth_limit(
&self,
axis_available_grid_space: Option<f32>,
) -> f32
pub fn fit_content_limited_growth_limit( &self, axis_available_grid_space: Option<f32>, ) -> f32
Returns true if the track is flexible (has a Flex MaxTrackSizingFunction), else false.
Sourcepub fn flex_factor(&self) -> f32
pub fn flex_factor(&self) -> f32
Returns the track’s flex factor if it is a flex track, else 0.