Externalize widget hit test to style definition.
This commit is contained in:
parent
2e5927e963
commit
6de65888dc
7 changed files with 18 additions and 17 deletions
8
core.lua
8
core.lua
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue