fix: add Panel::wrap_layout

Fixes #119
This commit is contained in:
Alexandre Bury 2017-03-15 16:35:20 -07:00
parent 0bbc10706e
commit 77433e80ee

View File

@ -31,7 +31,16 @@ impl<V: View> ViewWrapper for Panel<V> {
fn wrap_draw(&self, printer: &Printer) {
printer.print_box((0, 0), printer.size, true);
self.view
.draw(&printer.sub_printer((1, 1), printer.size - (2, 2), true));
self.view.draw(&printer.sub_printer((1, 1),
printer.size - (2, 2),
true));
}
fn wrap_layout(&mut self, size: Vec2) {
self.view.layout(if Vec2::new(2, 2).fits_in(size) {
size - (2, 2)
} else {
size
});
}
}