Skip to content

Commit

Permalink
try to fix SecondHalfGames#149 (clipping issue)
Browse files Browse the repository at this point in the history
  • Loading branch information
msparkles committed Apr 12, 2024
1 parent b4df755 commit ee921eb
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion crates/yakui-core/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,21 @@ impl LayoutDom {
// If this node enabled clipping, the next node under that is the node
// that clips this one.
let clipped_by = if clipping_enabled {
self.clip_stack.iter().nth_back(2).copied()
let mut iter = self.clip_stack.iter();
iter.next_back();
iter.next_back();

let mut result = None;
while let Some(id) = iter.next_back().copied() {
match dom.get(id).unwrap().widget.flow() {
crate::Flow::Inline => {
result = Some(id);
break;
}
crate::Flow::Relative { .. } => (),
}
}
result
} else {
self.clip_stack.last().copied()
};
Expand Down

0 comments on commit ee921eb

Please sign in to comment.