Components / Ruler

Ruler

Horizontal or vertical ruler in your units, with a round step for any zoom.

Example

The component itself, running in WebAssembly, beside its code in a playground. Try it.

Code

use ravenrs::prelude::*;

fn ruler() -> impl View {
    VStack::new((
        Ruler::horizontal().scale(2.0).origin(-20.0).marker(60.0),
        Ruler::horizontal().scale(0.2).whole_units(),
    ))
    .spacing(8.0)
    .align(Align::Stretch)
}

Open in the playground, with every example →

Full API of Ruler →