Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions slider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ return function(core, info, ...)
if core:isActive(opt.id) then
-- mouse update
local mx,my = core:getMousePosition()
if opt.vertical then
if opt.id.vertical then
fraction = math.min(1, math.max(0, (y+h - my) / h))
else
fraction = math.min(1, math.max(0, (mx - x) / w))
Expand All @@ -30,8 +30,8 @@ return function(core, info, ...)
end

-- keyboard update
local key_up = opt.vertical and 'up' or 'right'
local key_down = opt.vertical and 'down' or 'left'
local key_up = opt.id.vertical and 'up' or 'right'
local key_down = opt.id.vertical and 'down' or 'left'
if core:getPressedKey() == key_up then
info.value = math.min(info.max, info.value + info.step)
value_changed = true
Expand Down
4 changes: 2 additions & 2 deletions theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ end
function theme.Slider(fraction, opt, x,y,w,h)
local xb, yb, wb, hb -- size of the progress bar
local r = math.min(w,h) / 2.1
if opt.vertical then
if opt.id.vertical == true then
x, w = x + w*.25, w*.5
xb, yb, wb, hb = x, y+h*(1-fraction), w, h*fraction
else
Expand All @@ -97,7 +97,7 @@ function theme.Slider(fraction, opt, x,y,w,h)

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)
if opt.vertical then
if opt.id.vertical then
love.graphics.circle('fill', x+wb/2, yb, r)
else
love.graphics.circle('fill', x+wb, yb+hb/2, r)
Expand Down