Skip to main content

place

Function place 

Source
pub fn place(sel: Rect, size: Vec2, region: Rect) -> Option<Rect>
Expand description

Where a bar of size stands over a selection of sel, inside region — the part of the viewport the front end’s chrome leaves clear.

Centred above the selection, flipped below when that would land under the top chrome, and — for a selection taller than the region, which is an area whose interior is not hit-testable anyway — inside it. The fit test is vertical only: both candidates are wholly clear of the selection in y and the clamp moves the bar in x, which is why the bar provably never covers what is selected.

None only when there is no region at all to put it in.