mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-12-04 13:51:31 +00:00
fix: constructBarStyle
This commit is contained in:
parent
d1da81c1f8
commit
d4136f72da
1 changed files with 9 additions and 6 deletions
|
@ -89,9 +89,12 @@ function updateOomps(diff)
|
||||||
function constructBarStyle(layer, id) {
|
function constructBarStyle(layer, id) {
|
||||||
let bar = tmp[layer].bars[id]
|
let bar = tmp[layer].bars[id]
|
||||||
let style = {}
|
let style = {}
|
||||||
|
|
||||||
|
let tempProgress
|
||||||
if (bar.progress instanceof Decimal)
|
if (bar.progress instanceof Decimal)
|
||||||
bar.progress = bar.progress.toNumber()
|
tempProgress = (1 -Math.min(Math.max(bar.progress.toNumber(), 0), 1)) * 100
|
||||||
bar.progress = (1 -Math.min(Math.max(bar.progress, 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"}
|
style.dims = {'width': bar.width + "px", 'height': bar.height + "px"}
|
||||||
let dir = bar.direction
|
let dir = bar.direction
|
||||||
|
@ -99,19 +102,19 @@ function constructBarStyle(layer, id) {
|
||||||
|
|
||||||
switch(bar.direction) {
|
switch(bar.direction) {
|
||||||
case UP:
|
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'
|
style.fillDims.width = bar.width + 1 + 'px'
|
||||||
break;
|
break;
|
||||||
case DOWN:
|
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'
|
style.fillDims.width = bar.width + 1 + 'px'
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
style.fillDims['clip-path'] = 'inset(0% ' + bar.progress + '% 0% 0%)'
|
style.fillDims['clip-path'] = 'inset(0% ' + tempProgress + '% 0% 0%)'
|
||||||
break;
|
break;
|
||||||
case LEFT:
|
case LEFT:
|
||||||
style.fillDims['clip-path'] = 'inset(0% 0% 0% ' + bar.progress + '%)'
|
style.fillDims['clip-path'] = 'inset(0% 0% 0% ' + tempProgress + '%)'
|
||||||
break;
|
break;
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
style.fillDims['clip-path'] = 'inset(0% 50% 0% 0%)'
|
style.fillDims['clip-path'] = 'inset(0% 50% 0% 0%)'
|
||||||
|
|
Loading…
Reference in a new issue