Fix #43 by enforcing minimum size on box drawing
This commit is contained in:
parent
046233fc5f
commit
1d6626e6f4
1 changed files with 5 additions and 1 deletions
|
@ -21,6 +21,10 @@ end
|
||||||
function theme.drawBox(x,y,w,h, colors, cornerRadius)
|
function theme.drawBox(x,y,w,h, colors, cornerRadius)
|
||||||
local colors = colors or theme.getColorForState(opt)
|
local colors = colors or theme.getColorForState(opt)
|
||||||
cornerRadius = cornerRadius or theme.cornerRadius
|
cornerRadius = cornerRadius or theme.cornerRadius
|
||||||
|
w = math.max(cornerRadius/2, w)
|
||||||
|
if h < cornerRadius/2 then
|
||||||
|
y,h = y - (cornerRadius - h), cornerRadius/2
|
||||||
|
end
|
||||||
|
|
||||||
love.graphics.setColor(colors.bg)
|
love.graphics.setColor(colors.bg)
|
||||||
love.graphics.rectangle('fill', x,y, w,h, cornerRadius)
|
love.graphics.rectangle('fill', x,y, w,h, cornerRadius)
|
||||||
|
@ -89,7 +93,7 @@ function theme.Slider(fraction, opt, x,y,w,h)
|
||||||
|
|
||||||
local c = theme.getColorForState(opt)
|
local c = theme.getColorForState(opt)
|
||||||
theme.drawBox(x,y,w,h, c, opt.cornerRadius)
|
theme.drawBox(x,y,w,h, c, opt.cornerRadius)
|
||||||
theme.drawBox(x,yb,wb,hb, {bg=c.fg}, opt.cornerRadius)
|
theme.drawBox(xb,yb,wb,hb, {bg=c.fg}, opt.cornerRadius)
|
||||||
|
|
||||||
if opt.state ~= nil and opt.state ~= "normal" then
|
if opt.state ~= nil and opt.state ~= "normal" then
|
||||||
love.graphics.setColor((opt.color and opt.color.active or {}).fg or theme.color.active.fg)
|
love.graphics.setColor((opt.color and opt.color.active or {}).fg or theme.color.active.fg)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue