Implement overlay ordering for Image::float

This commit is contained in:
Héctor Ramón Jiménez 2025-04-25 11:20:16 +02:00
parent 7f1dcec391
commit e64c58d032
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
8 changed files with 416 additions and 143 deletions

View file

@ -14,8 +14,8 @@ use iced::widget::{
};
use iced::window;
use iced::{
Animation, ContentFit, Element, Fill, Function, Subscription, Task, Theme,
color,
Animation, Color, ContentFit, Element, Fill, Function, Shadow,
Subscription, Task, Theme, color,
};
use std::collections::HashMap;
@ -210,6 +210,19 @@ 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))
.float(true)
.style(move |_theme| image::Style {
shadow: Shadow {
color: Color::BLACK.scale_alpha(
thumbnail.zoom.interpolate(0.0, 1.0, now),
),
blur_radius: thumbnail
.zoom
.interpolate(0.0, 20.0, now),
..Shadow::default()
},
..image::Style::default()
})
.into()
} else {
horizontal_space().into()