Add solid and modal attributes.

The `solid` attribute determines whether to propagate events downwards.
When the widget being interacted with is not solid, events propagate down
to the next layout or to underlying handlers (for example love callbacks).
This is set by the theme and works mostly behind the scenes.

The `modal` attribute can be placed on a layout root to prevent input events
from propagating downwards, even those that fall outside of the layout.
This commit is contained in:
airstruck
2016-01-19 12:20:19 -05:00
parent d0628a8d1d
commit ab43dabcb9
4 changed files with 39 additions and 45 deletions

View File

@@ -73,16 +73,14 @@ return function (self)
self:onReshape(function (event)
local x1, y1, w, h = self:getRectangle(true, true)
local x2, y2 = x1 + w, y1 + h
local dim = math.min(w, h)
thumb.width, thumb.height = dim, dim
if self.flow == 'x' then
thumb.width = 0
thumb.height = false
local halfThumb = thumb:getWidth() / 2
x1, x2 = x1 + halfThumb, x2 - halfThumb
spacer.width = self.value * (x2 - x1)
spacer.height = false
else
thumb.width = false
thumb.height = 0
local halfThumb = thumb:getHeight() / 2
y1, y2 = y1 + halfThumb, y2 - halfThumb
spacer.width = false