Skip to main content

view

Function view 

Source
pub fn view(
    scene_px: (u32, u32),
    clip_px: (u32, u32),
    centre: (f32, f32),
    zoom: u8,
) -> (f32, f32)
Expand description

The origin_px (the scene pixel at the window’s top-left) that puts the scene pixel centre in the middle of the window.

scene_px is the scene’s size and clip_px the window’s, both in their own pixels; at zoom (clamped to 1..=MAX_ZOOM) the window shows clip_px / zoom scene pixels each way. The window never leaves the scene: near an edge it stops there. On an axis where the zoomed scene is smaller than the window, the scene is centred instead (the origin is then negative). A centre that isn’t a number counts as 0.