From 188f69219579d15803b1000dad48dc0931067331 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 17 Dec 2015 12:18:25 -0800 Subject: [PATCH] Center temperature graph in view. --- firmware/application/ui_debug.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/application/ui_debug.cpp b/firmware/application/ui_debug.cpp index fe64e7395..aaf6e25e4 100644 --- a/firmware/application/ui_debug.cpp +++ b/firmware/application/ui_debug.cpp @@ -64,15 +64,17 @@ void TemperatureWidget::paint(Painter& painter) { const auto rect = screen_rect(); + const Dim bar_width = 1; + const Dim margin_x = (rect.width() - (logger.capacity() * bar_width)) / 2; + const Coord rightmost_x = rect.right() - margin_x; + const auto history = logger.history(); for(size_t i=0; i(rect.right() - (history.size() - i) * 1), - static_cast(rect.bottom() - bar_height), - 1, bar_height - }; + const Coord x = rightmost_x - (history.size() - i) * bar_width; + const Coord y = rect.bottom() - bar_height; + const Rect bar_rect { x, y, bar_width, bar_height }; painter.fill_rectangle(bar_rect, Color::green()); }