This commit is contained in:
flightmansam 2021-09-03 23:12:19 +10:00 committed by GitHub
commit 798d0b9362
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -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))
@ -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

View file

@ -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
@ -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)