From d4136f72daeba0f6681147d2a2991b67ad9def4c Mon Sep 17 00:00:00 2001 From: Braeden Date: Sun, 27 Oct 2024 17:22:04 -0400 Subject: [PATCH] fix: constructBarStyle --- js/technical/displays.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/js/technical/displays.js b/js/technical/displays.js index ba5a086..c7b1052 100644 --- a/js/technical/displays.js +++ b/js/technical/displays.js @@ -89,9 +89,12 @@ function updateOomps(diff) function constructBarStyle(layer, id) { let bar = tmp[layer].bars[id] let style = {} + + let tempProgress if (bar.progress instanceof Decimal) - bar.progress = bar.progress.toNumber() - bar.progress = (1 -Math.min(Math.max(bar.progress, 0), 1)) * 100 + tempProgress = (1 -Math.min(Math.max(bar.progress.toNumber(), 0), 1)) * 100 + else + tempProgress = (1 -Math.min(Math.max(bar.progress, 0), 1)) * 100 style.dims = {'width': bar.width + "px", 'height': bar.height + "px"} let dir = bar.direction @@ -99,19 +102,19 @@ function constructBarStyle(layer, id) { switch(bar.direction) { case UP: - style.fillDims['clip-path'] = 'inset(' + bar.progress + '% 0% 0% 0%)' + style.fillDims['clip-path'] = 'inset(' + tempProgress + '% 0% 0% 0%)' style.fillDims.width = bar.width + 1 + 'px' break; case DOWN: - style.fillDims['clip-path'] = 'inset(0% 0% ' + bar.progress + '% 0%)' + style.fillDims['clip-path'] = 'inset(0% 0% ' + tempProgress + '% 0%)' style.fillDims.width = bar.width + 1 + 'px' break; case RIGHT: - style.fillDims['clip-path'] = 'inset(0% ' + bar.progress + '% 0% 0%)' + style.fillDims['clip-path'] = 'inset(0% ' + tempProgress + '% 0% 0%)' break; case LEFT: - style.fillDims['clip-path'] = 'inset(0% 0% 0% ' + bar.progress + '%)' + style.fillDims['clip-path'] = 'inset(0% 0% 0% ' + tempProgress + '%)' break; case DEFAULT: style.fillDims['clip-path'] = 'inset(0% 50% 0% 0%)'