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
|
@ -1,6 +1,6 @@
|
|||
local core = require((...):match("(.-)[^%.]+$") .. 'core')
|
||||
|
||||
return function(info, x,y,w,h, draw)
|
||||
return function(info, x,y,w,h, widgetHit, draw)
|
||||
assert(type(info) == 'table' and info.value, "Incomplete slider value info")
|
||||
info.min = info.min or 0
|
||||
info.max = info.max or math.max(info.value, 1)
|
||||
|
@ -8,7 +8,7 @@ return function(info, x,y,w,h, draw)
|
|||
local fraction = (info.value - info.min) / (info.max - info.min)
|
||||
|
||||
local id = core.generateID()
|
||||
core.mouse.updateState(id, x,y,w,h)
|
||||
core.mouse.updateState(id, widgetHit or core.style.widgetHit, x,y,w,h)
|
||||
core.makeCyclable(id)
|
||||
core.registerDraw(id,draw or core.style.Slider, fraction, x,y,w,h, info.vertical)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue