Misc improvements to Bounds in gpui geometry

* Makes `dilate` and `inset` return.

* Implements `Add<Point<T>>` and `Sub<Point<T>>`.

* Makes some trait constraints more precise.
This commit is contained in:
mgsloan@gmail.com 2024-12-17 00:10:10 -07:00
parent a062c0f1bc
commit ebf6804afd
2 changed files with 121 additions and 66 deletions

View file

@ -2281,9 +2281,7 @@ impl<'a> WindowContext<'a> {
let content_mask = self.content_mask();
let opacity = self.element_opacity();
for shadow in shadows {
let mut shadow_bounds = bounds;
shadow_bounds.origin += shadow.offset;
shadow_bounds.dilate(shadow.spread_radius);
let shadow_bounds = (bounds + shadow.offset).dilate(shadow.spread_radius);
self.window.next_frame.scene.insert_primitive(Shadow {
order: 0,
blur_radius: shadow.blur_radius.scale(scale_factor),