add horizontal scrolling, fix #3

This commit is contained in:
airstruck
2016-01-28 16:17:33 -05:00
parent 93e619862e
commit bbbdccb3b5
3 changed files with 36 additions and 16 deletions

View File

@@ -417,8 +417,9 @@ function Layout:addDefaultHandlers ()
createBehavior('scroll', {
self:onWheelMove(function (event)
if not event.hit then return end
local amount = event.scrollY ~= 0 and event.scrollY or event.scrollX
for widget in event.target:eachAncestor(true) do
if widget:scrollBy(nil, event.y) then return false end
if widget:scrollBy(amount) then return false end
end -- ancestor loop
return false
end) -- wheel move