some rework in UIWidget input

This commit is contained in:
Eduardo Bart
2012-03-26 10:34:43 -03:00
parent 532e8e3e39
commit 9309d6e7f3
13 changed files with 139 additions and 132 deletions

View File

@@ -22,7 +22,7 @@ local function calcValues(self)
local px = math.max(math.floor(proportion * pxrange), 10)
local offset = 0
if range > 1 then
offset = (((self.value - self.minimum) / (range - 1)) - 0.5) * (pxrange - px)
offset = math.ceil((((self.value - self.minimum) / (range - 1)) - 0.5) * (pxrange - px))
end
return range, pxrange, px, offset, center
@@ -153,6 +153,15 @@ function UIScrollBar:onGeometryChange()
updateSlider(self)
end
function UIScrollBar:onMouseWheel(mousePos, mouseWheel)
if mouseWheel == MouseWheelUp then
self:decrement()
else
self:increment()
end
return true
end
function UIScrollBar:getMaximum() return self.maximum end
function UIScrollBar:getMinimum() return self.minimum end
function UIScrollBar:getValue() return self.value end