pub struct FlowLayout {
pub blocks: HashMap<usize, BlockLayout>,
pub tables: HashMap<usize, TableLayout>,
pub frames: HashMap<usize, FrameLayout>,
pub flow_order: Vec<FlowItem>,
pub content_height: f32,
pub viewport_width: f32,
pub viewport_height: f32,
}Fields§
§blocks: HashMap<usize, BlockLayout>§tables: HashMap<usize, TableLayout>§frames: HashMap<usize, FrameLayout>§flow_order: Vec<FlowItem>§content_height: f32§viewport_width: f32§viewport_height: f32Implementations§
Source§impl FlowLayout
impl FlowLayout
pub fn new() -> Self
Sourcepub fn add_table(
&mut self,
registry: &FontRegistry,
params: &TableLayoutParams,
available_width: f32,
)
pub fn add_table( &mut self, registry: &FontRegistry, params: &TableLayoutParams, available_width: f32, )
Add a table to the flow at the current y position.
Sourcepub fn add_frame(
&mut self,
registry: &FontRegistry,
params: &FrameLayoutParams,
available_width: f32,
)
pub fn add_frame( &mut self, registry: &FontRegistry, params: &FrameLayoutParams, available_width: f32, )
Add a frame to the flow.
- Inline: placed in normal flow, advances content_height.
- FloatLeft: placed at current y, x=0. Does not advance content_height (surrounding content wraps around it).
- FloatRight: placed at current y, x=available_width - frame_width.
- Absolute: placed at (margin_left, margin_top) from document origin. Does not affect flow at all.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear all layout state. Call before rebuilding from a new FlowSnapshot.
Sourcepub fn add_block(
&mut self,
registry: &FontRegistry,
params: &BlockLayoutParams,
available_width: f32,
)
pub fn add_block( &mut self, registry: &FontRegistry, params: &BlockLayoutParams, available_width: f32, )
Add a single block to the flow at the current y position.
Sourcepub fn layout_blocks(
&mut self,
registry: &FontRegistry,
block_params: Vec<BlockLayoutParams>,
available_width: f32,
)
pub fn layout_blocks( &mut self, registry: &FontRegistry, block_params: Vec<BlockLayoutParams>, available_width: f32, )
Lay out a sequence of blocks vertically.
Sourcepub fn relayout_block(
&mut self,
registry: &FontRegistry,
params: &BlockLayoutParams,
available_width: f32,
)
pub fn relayout_block( &mut self, registry: &FontRegistry, params: &BlockLayoutParams, available_width: f32, )
Update a single block’s layout and shift subsequent blocks if height changed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FlowLayout
impl RefUnwindSafe for FlowLayout
impl Send for FlowLayout
impl Sync for FlowLayout
impl Unpin for FlowLayout
impl UnsafeUnpin for FlowLayout
impl UnwindSafe for FlowLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more