Clip shadow bounds of floating images to the viewport

This commit is contained in:
Héctor Ramón Jiménez 2025-04-26 03:16:45 +02:00
parent 385cfcddb2
commit c4e6e42759
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -538,6 +538,10 @@ where
let clip_bounds = bounds.zoom(self.image.scale);
let style = theme.style(&self.image.class);
let clip_bounds = clip_bounds
.intersection(&self.viewport)
.unwrap_or(self.viewport);
if style.shadow.color.a > 0.0 {
renderer.with_layer(
clip_bounds.expand(style.shadow.blur_radius),
@ -558,10 +562,6 @@ where
);
}
let clip_bounds = clip_bounds
.intersection(&self.viewport)
.unwrap_or(self.viewport);
renderer.with_layer(clip_bounds, |renderer| {
render(
renderer,