From 0033ab76a35510d66dba21ac0e5dfd234e3668b5 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 20 Apr 2022 15:07:08 -0400 Subject: [PATCH] Tweak position of meter percentage text. Omit "%" for 2 HP modules. --- src/app/ModuleWidget.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/ModuleWidget.cpp b/src/app/ModuleWidget.cpp index 76a1b3ae..29a80ab4 100644 --- a/src/app/ModuleWidget.cpp +++ b/src/app/ModuleWidget.cpp @@ -263,9 +263,14 @@ void ModuleWidget::draw(const DrawArgs& args) { // Text float percent = meterBuffer[meterIndex] * sampleRate * 100.f; // float microseconds = meterBuffer[meterIndex] * 1e6f; - std::string meterText = string::f("%.1f%%", percent); - float x = box.size.x - bndLabelWidth(args.vg, -1, meterText.c_str()); - bndMenuLabel(args.vg, x, plotHeight, INFINITY, BND_WIDGET_HEIGHT, -1, meterText.c_str()); + std::string meterText = string::f("%.1f", percent); + // Only append "%" if wider than 2 HP + if (box.getWidth() > RACK_GRID_WIDTH * 2) + meterText += "%"; + math::Vec pt; + pt.x = box.size.x - bndLabelWidth(args.vg, -1, meterText.c_str()) + 3; + pt.y = plotHeight + 0.5; + bndMenuLabel(args.vg, VEC_ARGS(pt), INFINITY, BND_WIDGET_HEIGHT, -1, meterText.c_str()); } // Selection