Implement Image::translate for positioning floating images

This commit is contained in:
Héctor Ramón Jiménez 2025-04-25 13:31:49 +02:00
parent e64c58d032
commit a2a7c18c9d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 81 additions and 22 deletions

View file

@ -210,6 +210,12 @@ fn card<'a>(
.content_fit(ContentFit::Cover)
.opacity(thumbnail.fade_in.interpolate(0.0, 1.0, now))
.scale(thumbnail.zoom.interpolate(1.0, 1.1, now))
.translate(move |bounds, viewport| {
let final_bounds = bounds.zoom(1.1);
final_bounds.offset(&viewport.shrink(10))
* thumbnail.zoom.interpolate(0.0, 1.0, now)
})
.float(true)
.style(move |_theme| image::Style {
shadow: Shadow {