Fix percent function to return minimum zero

The percent function is used for ui-bars. When returning numbers below zero the bar will show up with 100% width, 'cause css don't know negative width.
This commit is contained in:
Steffen Breiler 2014-09-18 01:26:52 +02:00
parent 30be8749c4
commit 9bfd38c5f9

View file

@ -199,7 +199,7 @@ api.percent = (x,y, dir) ->
when "down" then roundFn = Math.floor
else roundFn = Math.round
x=1 if x==0
roundFn(x/y*100)
Math.max(0,roundFn(x/y*100))
###
Remove whitespace #FIXME are we using this anywwhere? Should we be?