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 9d9b525
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 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,22 @@ 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() {
dbg!(dom.get(id).unwrap().widget.flow());
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 9d9b525

Please sign in to comment.