minor tweaks

This commit is contained in:
airstruck
2015-10-31 15:32:48 -04:00
parent 1e668f8f09
commit 6c82e5f81d
7 changed files with 8 additions and 7 deletions

View File

@@ -38,6 +38,8 @@ return function (self)
local function press (event)
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:reshape()
self.layout:tryFocus(thumb)
@@ -56,6 +58,8 @@ return function (self)
self:onReshape(function (event)
local x1, y1, x2, y2 = self:getRectangle(true, true)
spacer.width = self.value * (x2 - x1 - thumb:getWidth())
local halfThumb = thumb:getWidth() / 2
x1, x2 = x1 + halfThumb, x2 - halfThumb
spacer.width = self.value * (x2 - x1)
end)
end