Skip to content

Commit

Permalink
re #24. Use draw function on ViewTuple.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtholliday committed Jun 29, 2022
1 parent 76fbf47 commit defa09b
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/views/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,7 @@ impl<VT: ViewTuple + 'static> View for Stack<VT> {
}

fn draw(&self, id: ViewId, cx: &mut Context, vger: &mut Vger) {
let mut c = 0;
self.children.foreach_view(&mut |child| {
let child_id = id.child(&c);
let layout_box = cx.layout[&child_id];

vger.save();

vger.translate(layout_box.offset);

(*child).draw(child_id, cx, vger);
c += 1;

if DEBUG_LAYOUT {
let paint = vger.color_paint(CONTROL_BACKGROUND);
vger.stroke_rect(
layout_box.rect.min(),
layout_box.rect.max(),
0.0,
1.0,
paint,
);
}

vger.restore();
})
self.children.draw(id, cx, vger);
}

fn layout(&self, id: ViewId, sz: LocalSize, cx: &mut Context, vger: &mut Vger) -> LocalSize {
Expand Down

0 comments on commit defa09b

Please sign in to comment.