From 38711975540d7957275cde1aec19657dbde97fdf Mon Sep 17 00:00:00 2001 From: stweedo <108593831+stweedo@users.noreply.github.com> Date: Sun, 4 Jun 2023 02:02:42 -0500 Subject: [PATCH] Update app.js - Minor font sizing changes --- apps/ohmcalc/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/ohmcalc/app.js b/apps/ohmcalc/app.js index fc6bda81c..600c12431 100644 --- a/apps/ohmcalc/app.js +++ b/apps/ohmcalc/app.js @@ -256,7 +256,7 @@ function calculateValue(calculatedVariable, variableValues) { g.setFontVector(fontSize); // Reduce the font size until both the value and unit fit on the screen - while (g.stringWidth(result.value) > g.getWidth() - 20 || g.getFontHeight() > g.getHeight() / 2) { + while (g.stringWidth(result.value) > g.getWidth() - 10 || g.getFontHeight() > g.getHeight() / 2) { fontSize--; g.setFontVector(fontSize); } @@ -317,8 +317,8 @@ function calculateValue(calculatedVariable, variableValues) { // Calculate the font size for value dynamically let valueFontSize = fontSize; // Initialize with maximum possible font size g.setFontVector(valueFontSize); - while (g.stringWidth(resultValue) > g.getWidth() && valueFontSize > 1) { - valueFontSize *= 0.9; // Reduce the font size by 10% + while (g.stringWidth(resultValue) > g.getWidth() - 10) { + valueFontSize--; // Reduce the font size by 1 g.setFontVector(valueFontSize); }