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

@@ -33,7 +33,9 @@ function UIScrollArea:updateScrollBars()
if scrollbar then
if self.inverted then
scrollbar:setMinimum(-scrollheight)
scrollbar:setMaximum(0)
else
scrollbar:setMinimum(0)
scrollbar:setMaximum(scrollheight)
end
end
@@ -50,10 +52,8 @@ end
function UIScrollArea:setVerticalScrollBar(scrollbar)
self.verticalScrollBar = scrollbar
scrollbar:setMaximum(0)
self.verticalScrollBar.onValueChange = function(scrollbar, value)
local virtualOffset = self:getVirtualOffset()
if self.inverted then value = -value end
virtualOffset.y = value
self:setVirtualOffset(virtualOffset)
end
@@ -72,3 +72,14 @@ end
function UIScrollArea:onLayoutUpdate()
self:updateScrollBars()
end
function UIScrollArea:onMouseWheel(mousePos, mouseWheel)
if self.verticalScrollBar then
if mouseWheel == MouseWheelUp then
self.verticalScrollBar:decrement()
else
self.verticalScrollBar:increment()
end
end
return true
end