From 1d6626e6f4003a6decb7d8783e5e3f373f9884d1 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Sun, 28 Aug 2016 18:33:40 +0200 Subject: [PATCH] Fix #43 by enforcing minimum size on box drawing --- theme.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/theme.lua b/theme.lua index d0dd376..fe8b416 100644 --- a/theme.lua +++ b/theme.lua @@ -21,6 +21,10 @@ end function theme.drawBox(x,y,w,h, colors, cornerRadius) local colors = colors or theme.getColorForState(opt) 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.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) 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 love.graphics.setColor((opt.color and opt.color.active or {}).fg or theme.color.active.fg)