From 493ed1322c52a9282ff5bc191159095b02937066 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Mon, 18 May 2015 12:24:08 -0700 Subject: [PATCH] Fix stack_view when screen is smaller than content --- src/view/stack_view.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/view/stack_view.rs b/src/view/stack_view.rs index 8db29da..ae932d7 100644 --- a/src/view/stack_view.rs +++ b/src/view/stack_view.rs @@ -44,7 +44,9 @@ impl View for StackView { match self.layers.last() { None => (), 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)); }, }