centered image and zoom to cursor

This commit is contained in:
Cory Forsstrom 2020-05-27 13:39:26 -07:00
parent 5d045c2e9a
commit de176beb28
No known key found for this signature in database
GPG key ID: 64D6B5851FFCAC9E
2 changed files with 203 additions and 95 deletions

View file

@ -7,7 +7,7 @@ impl image::viewer::Renderer for Renderer {
state: &image::State,
bounds: Rectangle,
image_bounds: Rectangle,
offset: (u32, u32),
translation: Vector,
handle: image::Handle,
is_mouse_over: bool,
) -> Self::Output {
@ -15,11 +15,14 @@ impl image::viewer::Renderer for Renderer {
{
Primitive::Clip {
bounds,
offset: Vector::new(offset.0, offset.1),
content: Box::new(Primitive::Image {
handle,
bounds: image_bounds,
content: Box::new(Primitive::Translate {
translation,
content: Box::new(Primitive::Image {
handle,
bounds: image_bounds,
}),
}),
offset: Vector::new(0, 0),
}
},
{