Skip to main content

controls

Function controls 

pub fn controls<F>(
    prefix: &str,
    model: &ZoomModel,
    default_label: &str,
    on_step: F,
) -> Vec<Button>
where F: FnMut(ZoomStep) + 'static,
Expand description

The toolkit’s zoom controls, in the toolkit’s own buttons: out, the level (which returns the content to its own size), and in. prefix names the three of them for tests and assistive technology (.zoom-out, .zoom-level, .zoom-in); default_label is what the middle one says while the content shows at its own size (“Fit to window”, “Actual size”).

The caller places the buttons where its chrome keeps them — a toolbar row, a window’s control cluster — and handles the step. A button whose step would change nothing is disabled, so the bounds are visible rather than mysterious.