Externalize widget hit test to style definition.

This commit is contained in:
Matthias Richter 2012-03-14 16:19:46 +01:00
parent 2e5927e963
commit 6de65888dc
7 changed files with 18 additions and 17 deletions

View file

@ -29,12 +29,8 @@ keyboard.cycle = {
next = {key = 'tab'},
}
function mouse.inRect(x,y,w,h)
return mouse.x >= x and mouse.x <= x+w and mouse.y >= y and mouse.y <= y+h
end
function mouse.updateState(id, x,y,w,h)
if mouse.inRect(x,y,w,h) then
function mouse.updateState(id, widgetHit, ...)
if widgetHit(mouse.x, mouse.y, ...) then
setHot(id)
if not context.active and mouse.down then
setActive(id)