Skip to main content

plan_drag

Function plan_drag 

pub fn plan_drag(
    placed: &[Placed],
    above: usize,
    delta: f32,
    empty: f32,
    mode: DragMode,
) -> DragPlan
Expand description

What moving the boundary under the section above by delta does (down if positive), from the heights in placed; empty is the room under the last section.

A drag plans each move from the heights shown, by the distance between the boundary and the pointer, so that it stays under the pointer: what a drag shrank stays shrunk, and a move back gives the room where a fresh drag would. Plans compose: a move of a then of b the same way is a move of a + b. When above is not an open section or no section lies below it, no boundary is there: nothing moves and the plan says so (moved is 0). With only folded sections below it, nothing else can give or take: down, it takes the empty room, and up, it opens some, the folded bands following.