fix: intersect nested clip bounds with parent layer
This commit is contained in:
parent
b5b2b2fcc3
commit
371dd94a2a
1 changed files with 9 additions and 2 deletions
|
|
@ -83,13 +83,20 @@ impl<T: Layer> Stack<T> {
|
|||
/// Pushes a new clipping region in the [`Stack`]; creating a new layer in the
|
||||
/// process.
|
||||
pub fn push_clip(&mut self, bounds: Rectangle) {
|
||||
let bounds = bounds * self.transformation();
|
||||
let bounds = bounds
|
||||
.intersection(&self.layers[self.current].bounds())
|
||||
.unwrap_or(Rectangle {
|
||||
width: 0.0,
|
||||
height: 0.0,
|
||||
..bounds
|
||||
});
|
||||
|
||||
self.previous.push(self.current);
|
||||
|
||||
self.current = self.active_count;
|
||||
self.active_count += 1;
|
||||
|
||||
let bounds = bounds * self.transformation();
|
||||
|
||||
if self.current == self.layers.len() {
|
||||
self.layers.push(T::with_bounds(bounds));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue