Components / CropOverlay
CropOverlay
A crop with a veil, proportion and angle, returning the rectangle and the angle.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn crop_overlay() -> impl View {
let crop = State::new(CropArea::new(Rect::new(70.0, 30.0, 240.0, 150.0)));
let picture = Canvas::new(|frame, scene| {
// ravenrs-lint: allow(raw_color) the sky of the stand-in photograph being cropped
let sky = LinearGradient::vertical(Color::rgb(0.3, 0.45, 0.7), Color::rgb(0.85, 0.6, 0.45));
scene.push_quad(Quad::new(frame, sky));
})
.size(400.0, 220.0);
VStack::new((
CropOverlay::new(crop.binding()).stage(picture),
Protractor::new(crop.binding().map(|c| c.angle, |c, angle| c.angle = angle)).width(400.0),
))
.spacing(8.0)
}