Update app.js - Minor font sizing changes

master
stweedo 2023-06-04 02:02:42 -05:00 committed by GitHub
parent bbbd200e2f
commit 3871197554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -256,7 +256,7 @@ function calculateValue(calculatedVariable, variableValues) {
g.setFontVector(fontSize); g.setFontVector(fontSize);
// Reduce the font size until both the value and unit fit on the screen // 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--; fontSize--;
g.setFontVector(fontSize); g.setFontVector(fontSize);
} }
@ -317,8 +317,8 @@ function calculateValue(calculatedVariable, variableValues) {
// Calculate the font size for value dynamically // Calculate the font size for value dynamically
let valueFontSize = fontSize; // Initialize with maximum possible font size let valueFontSize = fontSize; // Initialize with maximum possible font size
g.setFontVector(valueFontSize); g.setFontVector(valueFontSize);
while (g.stringWidth(resultValue) > g.getWidth() && valueFontSize > 1) { while (g.stringWidth(resultValue) > g.getWidth() - 10) {
valueFontSize *= 0.9; // Reduce the font size by 10% valueFontSize--; // Reduce the font size by 1
g.setFontVector(valueFontSize); g.setFontVector(valueFontSize);
} }