Skip to main content

ComputeContentSize

Trait ComputeContentSize 

Source
pub trait ComputeContentSize: SystemParam {
    type Components: ReadOnlyWorldQuery + 'static;

    // Required method
    fn compute_content(
        &self,
        components: ROQueryItem<'_, Self::Components>,
        set_size: Size<Option<f32>>,
    ) -> Size<f32>;
}
Expand description

A SystemParam to compute the size of content-sized layout Nodes.

In order to compute the size of content-sized nodes, you should also define a ComputeContentParam and add it to the app using AppContentSizeExt::add_content_sized.

Required Associated Types§

Source

type Components: ReadOnlyWorldQuery + 'static

Components of the thing which content affect the node’s size.

This is passed to Self::compute_content in addition to the sizes.

Required Methods§

Source

fn compute_content( &self, components: ROQueryItem<'_, Self::Components>, set_size: Size<Option<f32>>, ) -> Size<f32>

Given provided set bounds (Some is set, None if content-sized), return content-sized bounds.

Note that non-content-sized axis will keep the pre-set size, even if a different value is returned for that axis.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§