add mouse wheel events and scroll attribute

This commit is contained in:
airstruck
2015-12-01 11:15:42 -05:00
parent 44d541bc8f
commit 591bb7507a
9 changed files with 140 additions and 12 deletions

View File

@@ -213,16 +213,30 @@ end
function Input:handleReshape (layout, width, height)
local root = layout.root
Event.Reshape:emit(layout, {
target = layout
})
Event.Reshape:emit(layout, { target = layout })
if root.float then
return
if not root.float then
root.width = width
root.height = height
end
end
function Input:handleWheelMove (layout, x, y)
local root = layout.root
local mx, my = Backend.getMousePosition()
local widget = layout:getWidgetAt(mx, my)
if not widget then
hit = nil
widget = layout.root
end
root.width = width
root.height = height
widget:bubbleEvent('WheelMove', {
hit = hit,
x = x, y = y
})
return hit
end
Input.default = Input()