Fix stack_view when screen is smaller than content

This commit is contained in:
Alexandre Bury 2015-05-18 12:24:08 -07:00
parent 1fcca9b3a9
commit 493ed1322c

View File

@ -44,7 +44,9 @@ impl View for StackView {
match self.layers.last() { match self.layers.last() {
None => (), None => (),
Some(v) => { Some(v) => {
let offset = (printer.size - v.size) / 2; // Center the view
let view_size = Vec2::min(printer.size, v.size);
let offset = (printer.size - view_size) / 2;
v.view.draw(&printer.sub_printer(offset, v.size)); v.view.draw(&printer.sub_printer(offset, v.size));
}, },
} }