Make Overlay aware of viewport

... and unify `Image::float` and `Image::translate`
This commit is contained in:
Héctor Ramón Jiménez 2025-04-26 02:51:32 +02:00
parent a2a7c18c9d
commit 6c51a9579d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
29 changed files with 121 additions and 56 deletions

View file

@ -212,11 +212,9 @@ fn card<'a>(
.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 {
color: Color::BLACK.scale_alpha(

View file

@ -425,6 +425,7 @@ mod toast {
state: &'b mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
viewport: &Rectangle,
translation: Vector,
) -> Option<overlay::Element<'b, Message, Theme, Renderer>> {
let instants = state.state.downcast_mut::<Vec<Option<Instant>>>();
@ -435,6 +436,7 @@ mod toast {
&mut content_state[0],
layout,
renderer,
viewport,
translation,
);