mirror of
https://github.com/penpot/penpot.git
synced 2025-06-20 08:56:59 +02:00
🐛 Fix drop shadows viewport clipping
This commit is contained in:
parent
fa0da3a695
commit
731c21f082
6 changed files with 174 additions and 63 deletions
|
@ -123,4 +123,33 @@ impl Shadow {
|
|||
|
||||
filter
|
||||
}
|
||||
|
||||
// New methods for DropShadow
|
||||
pub fn get_drop_shadow_paint(&self) -> skia::Paint {
|
||||
let mut paint = skia::Paint::default();
|
||||
|
||||
let image_filter = self.get_drop_shadow_filter();
|
||||
|
||||
paint.set_image_filter(image_filter);
|
||||
paint.set_anti_alias(true);
|
||||
|
||||
paint
|
||||
}
|
||||
|
||||
fn get_drop_shadow_filter(&self) -> Option<ImageFilter> {
|
||||
let mut filter = image_filters::drop_shadow_only(
|
||||
(self.offset.0, self.offset.1),
|
||||
(self.blur, self.blur),
|
||||
self.color,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
);
|
||||
|
||||
if self.spread > 0. {
|
||||
filter = image_filters::dilate((self.spread, self.spread), filter, None);
|
||||
}
|
||||
|
||||
filter
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue