Skip to main content

axis_fraction

Function axis_fraction 

Source
pub fn axis_fraction(
    pointer: Point<Pixels>,
    bounds: Bounds<Pixels>,
    axis: Axis,
    min: f32,
) -> f32
Expand description

Where pointer falls along axis as a fraction of bounds — what a divider dragged there makes the split, and what a slider dragged there makes the value. Axis::Horizontal travels in x.

Clamped to min..=1-min — the dead zone a split passes so neither pane can be squeezed away, and the 0.0 a slider passes because it has none. On a zero-extent container the answer is min: the frame before layout has run would otherwise divide by zero.