mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-12-03 13:21:34 +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) {
|
||||
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%)'
|
||||
|
|
Loading…
Reference in a new issue