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%)'