From 10d384f3d76308469b720adbb448fdb2ca717300 Mon Sep 17 00:00:00 2001 From: liquidev Date: Fri, 25 Oct 2024 21:45:51 +0200 Subject: [PATCH] brush-cost: prevent percentage values from overflowing --- static/brush-cost.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/brush-cost.js b/static/brush-cost.js index 31e2263..1b6a690 100644 --- a/static/brush-cost.js +++ b/static/brush-cost.js @@ -17,7 +17,7 @@ class Gauge extends HTMLElement { setValue(value, valueMax) { let clampedNormalized = Math.max(0, Math.min(1, value / valueMax)); this.style.setProperty("--progress", `${clampedNormalized * 100}%`); - this.title = `${this.label}: ${value} / ${valueMax} (${Math.ceil((value / valueMax) * 100)}%)`; + this.title = `${this.label}: ${value} / ${valueMax} (${Math.ceil(clampedNormalized * 100)}%)`; } }