mirror of
https://github.com/airstruck/luigi.git
synced 2025-12-19 10:26:43 +00:00
hotkeys use modifiers
This commit is contained in:
@@ -4,7 +4,7 @@ return function (self)
|
||||
return value < 0 and 0 or value > 1 and 1 or value
|
||||
end
|
||||
|
||||
self:setValue(clamp(self.value or 0.5))
|
||||
self.value = clamp(self.value or 0.5)
|
||||
self.step = self.step or 0.01
|
||||
self.flow = 'x' -- TODO: support vertical slider
|
||||
|
||||
@@ -28,9 +28,9 @@ return function (self)
|
||||
thumb:onKeyPress(function (event)
|
||||
local key = event.key
|
||||
if key == 'left' or key == 'down' then
|
||||
self:setValue(clamp(self.value - self.step))
|
||||
self.value = clamp(self.value - self.step)
|
||||
elseif event.key == 'right' or key == 'up' then
|
||||
self:setValue(clamp(self.value + self.step))
|
||||
self.value = clamp(self.value + self.step)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -38,7 +38,7 @@ return function (self)
|
||||
local x1, y1, x2, y2 = self:getRectangle(true, true)
|
||||
local halfThumb = thumb:getWidth() / 2
|
||||
x1, x2 = x1 + halfThumb, x2 - halfThumb
|
||||
self:setValue(clamp((event.x - x1) / (x2 - x1)))
|
||||
self.value = clamp((event.x - x1) / (x2 - x1))
|
||||
thumb:focus()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user