better slider highlight detection
This commit is contained in:
parent
a629964d63
commit
d2f00ea0fd
1 changed files with 5 additions and 2 deletions
7
main.lua
7
main.lua
|
@ -77,8 +77,11 @@ function love.draw()
|
||||||
love.graphics.translate(sx, sy)
|
love.graphics.translate(sx, sy)
|
||||||
love.graphics.rotate((mixpoint - oldmixpoint) * 4 + mixpointspin * math.pi * 2)
|
love.graphics.rotate((mixpoint - oldmixpoint) * 4 + mixpointspin * math.pi * 2)
|
||||||
|
|
||||||
|
local hovering = mx > sx - ssize/2 and mx < sx + ssize/2 and my > sy - ssize/2 and my < sy + ssize/2 and dropdown.openDropdown == 0
|
||||||
|
local dragging = mx > x and mx < x + w and my > y and my < y + h and love.mouse.isDown(1) and dropdown.openDropdown == 0
|
||||||
|
|
||||||
love.graphics.setColor(0, 0, 0, 1)
|
love.graphics.setColor(0, 0, 0, 1)
|
||||||
if mx > sx - ssize/2 and mx < sx + ssize/2 and my > sy - ssize/2 and my < sy + ssize/2 and dropdown.openDropdown == 0 then
|
if hovering or dragging then
|
||||||
love.graphics.setColor(0.2, 0.2, 0.3, 1)
|
love.graphics.setColor(0.2, 0.2, 0.3, 1)
|
||||||
end
|
end
|
||||||
love.graphics.rectangle('fill', -ssize/2, -ssize/2, ssize, ssize)
|
love.graphics.rectangle('fill', -ssize/2, -ssize/2, ssize, ssize)
|
||||||
|
@ -92,7 +95,7 @@ function love.draw()
|
||||||
|
|
||||||
love.graphics.pop()
|
love.graphics.pop()
|
||||||
|
|
||||||
if mx > x and mx < x + w and my > y and my < y + h and love.mouse.isDown(1) and dropdown.openDropdown == 0 then
|
if dragging then
|
||||||
mixpoint = (mx - x) / w
|
mixpoint = (mx - x) / w
|
||||||
graph.touchtimer = 1
|
graph.touchtimer = 1
|
||||||
dropdown.createDropdowns()
|
dropdown.createDropdowns()
|
||||||
|
|
Loading…
Reference in a new issue