mirror of
https://github.com/danbulant/cushy
synced 2026-06-21 15:42:07 +00:00
parent
02e60e1049
commit
5a5f6c9229
2 changed files with 17 additions and 1 deletions
|
|
@ -111,6 +111,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
display scale is changed.
|
||||
- `Button`'s colors are now fully reactive. The caching code to prevent color
|
||||
duplicate change animations has been simplified to fix this.
|
||||
- Clipping math of widgets with negative origins has been fixed to no longer
|
||||
allow overdrawing the widget's bounds. This was noticable in the
|
||||
nested-scroll.rs example when reducing the height of the window below 6
|
||||
inches.
|
||||
|
||||
### Added
|
||||
|
||||
|
|
|
|||
|
|
@ -88,10 +88,22 @@ impl<'clip, 'gfx, 'pass> Graphics<'clip, 'gfx, 'pass> {
|
|||
/// operations will be relative to the origin of `clip`.
|
||||
pub fn clipped_to(&mut self, clip: Rect<Px>) -> Graphics<'_, 'gfx, 'pass> {
|
||||
let region = clip + self.region.origin;
|
||||
|
||||
// If the current region has a negative component, we need to adjust the
|
||||
// clipped rect before we perform an intersection in unsigned space.
|
||||
let mut effective_region = region;
|
||||
if region.origin.x < 0 {
|
||||
effective_region.size.width += region.origin.x;
|
||||
effective_region.origin.x = Px::ZERO;
|
||||
}
|
||||
if region.origin.y < 0 {
|
||||
effective_region.size.height += region.origin.y;
|
||||
effective_region.origin.y = Px::ZERO;
|
||||
}
|
||||
let new_clip = self
|
||||
.renderer
|
||||
.clip_rect()
|
||||
.intersection(®ion.into_unsigned())
|
||||
.intersection(&effective_region.into_unsigned())
|
||||
.map(|intersection| intersection - self.renderer.clip_rect().origin)
|
||||
.unwrap_or_default();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue