pub struct LayoutManager {
pub coordinate_system: CoordinateSystem,
pub current_y: f64,
pub page_width: f64,
pub page_height: f64,
pub margins: Margins,
pub element_spacing: f64,
}Expand description
Layout manager for intelligent positioning of elements on a page
This manager handles automatic positioning of tables, images, and other elements using different coordinate systems while preventing overlaps and managing page flow.
Fields§
§coordinate_system: CoordinateSystemCoordinate system being used
current_y: f64Current Y position for next element
page_width: f64Page dimensions
page_height: f64§margins: MarginsPage margins
element_spacing: f64Spacing between elements
Implementations§
Source§impl LayoutManager
impl LayoutManager
Sourcepub fn new(page: &Page, coordinate_system: CoordinateSystem) -> Self
pub fn new(page: &Page, coordinate_system: CoordinateSystem) -> Self
Create a new layout manager for the given page
Sourcepub fn with_element_spacing(self, spacing: f64) -> Self
pub fn with_element_spacing(self, spacing: f64) -> Self
Set custom spacing between elements
Sourcepub fn will_fit(&self, element_height: f64) -> bool
pub fn will_fit(&self, element_height: f64) -> bool
Check if an element of given height will fit on the current page
Sourcepub fn remaining_space(&self) -> f64
pub fn remaining_space(&self) -> f64
Get the current available space remaining on the page
Sourcepub fn add_element(&mut self, element_height: f64) -> Option<f64>
pub fn add_element(&mut self, element_height: f64) -> Option<f64>
Reserve space for an element and return its Y position
Returns None if the element doesn’t fit on the current page.
If it fits, returns the Y coordinate where the element should be placed
and updates the internal current_y for the next element.