Skip to content

Commit

Permalink
#50 process events in reverse draw order
Browse files Browse the repository at this point in the history
  • Loading branch information
wtholliday committed Jun 16, 2023
1 parent 9d1847c commit d34f2a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/views/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ where
cx: &mut Context,
actions: &mut Vec<Box<dyn Any>>,
) {
for child in &self.ids {
for child in self.ids.iter().rev() {
let child_id = id.child(child);
let offset = cx.layout.entry(child_id).or_default().offset;
((self.func)(child)).process(&event.offset(-offset), child_id, cx, actions);
Expand Down
6 changes: 3 additions & 3 deletions src/views/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ impl<VT: ViewTuple + 'static, D: StackDirection + 'static> View for Stack<VT, D>
cx: &mut Context,
actions: &mut Vec<Box<dyn Any>>,
) {
let mut c = 0;
self.children.foreach_view(&mut |child| {
let mut c = self.children.len() as i32 - 1;
self.children.foreach_view_rev(&mut |child| {
let child_id = id.child(&c);
let offset = cx.layout.entry(child_id).or_default().offset;
(*child).process(&event.offset(-offset), child_id, cx, actions);
c += 1;
c -= 1;
})
}

Expand Down

0 comments on commit d34f2a0

Please sign in to comment.