aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhryx <codroid@gmail.com>2013-03-25 23:15:50 -0700
committerhryx <codroid@gmail.com>2013-03-25 23:15:50 -0700
commitddd4791e8c39e2343c672e555f4564b875d00e7a (patch)
treee8914c0b37edbf4d1926535d7e9d2a8066023b30
parent43265a44ca25b17225eeeae8d377d29fb7c7ee45 (diff)
downloadQuickie-ddd4791e8c39e2343c672e555f4564b875d00e7a.tar.gz
Quickie-ddd4791e8c39e2343c672e555f4564b875d00e7a.tar.bz2
Quickie-ddd4791e8c39e2343c672e555f4564b875d00e7a.tar.xz
Quickie-ddd4791e8c39e2343c672e555f4564b875d00e7a.zip
Fix vertical Slider
Slider, when vertical, was drawing the grab box with inverted position. Center "track" had incorrect orientation. Also, slider.lua was passing a bunk table to group.getRect().
-rw-r--r--slider.lua2
-rw-r--r--style-default.lua18
2 files changed, 12 insertions, 8 deletions
diff --git a/slider.lua b/slider.lua
index 1a0ef77..4700ae5 100644
--- a/slider.lua
+++ b/slider.lua
@@ -39,7 +39,7 @@ return function(w)
local fraction = (w.info.value - w.info.min) / (w.info.max - w.info.min)
local id = w.id or core.generateID()
- local pos, size = group.getRect(w.pos, w.info.size)
+ local pos, size = group.getRect(w.pos, w.size)
mouse.updateWidget(id, pos, size, w.widgetHit)
keyboard.makeCyclable(id)
diff --git a/style-default.lua b/style-default.lua
index a0e3fdf..95aecef 100644
--- a/style-default.lua
+++ b/style-default.lua
@@ -82,20 +82,24 @@ end
local function Slider(state, fraction, vertical, x,y,w,h)
local c = color[state]
- love.graphics.setLineWidth(2)
+ love.graphics.setLine(2, 'rough')
love.graphics.setColor(c.border)
- love.graphics.line(x,y+h/2-1,x+w,y+h/2-1)
- love.graphics.line(x,y+h/2+1,x+w,y+h/2+1)
- love.graphics.setColor(c.bg)
- love.graphics.line(x,y+h/2,x+w,y+h/2)
-
if vertical then
- y = math.floor(y + h * fraction - 5)
+ love.graphics.line(x+w/2-1,y,x+w/2-1,y+h)
+ love.graphics.line(x+w/2+1,y,x+w/2+1,y+h)
+ love.graphics.setColor(c.bg)
+ love.graphics.line(x+w/2,y,x+w/2,y+h)
+ y = math.floor(y + h - h * fraction - 5)
h = 10
else
+ love.graphics.line(x,y+h/2-1,x+w,y+h/2-1)
+ love.graphics.line(x,y+h/2+1,x+w,y+h/2+1)
+ love.graphics.setColor(c.bg)
+ love.graphics.line(x,y+h/2,x+w,y+h/2)
x = math.floor(x + w * fraction - 5)
w = 10
end
+
box(x,y,w,h, c.bg,c.border)
end