mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
#111 Add druid.stencil_check for auto stencil check to call set_click_zone
This commit is contained in:
@@ -171,6 +171,32 @@ function M.is_enabled(node)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Return closest non inverted clipping parent node for node
|
||||
-- @function helper.get_closest_stencil_node
|
||||
-- @tparam node node Gui node
|
||||
-- @treturn node|nil The clipping node
|
||||
function M.get_closest_stencil_node(node)
|
||||
if not node then
|
||||
return nil
|
||||
end
|
||||
|
||||
local parent = gui.get_parent(node)
|
||||
while parent do
|
||||
local clipping_mode = gui.get_clipping_mode(parent)
|
||||
local is_clipping_normal = not gui.get_clipping_inverted(parent)
|
||||
|
||||
if is_clipping_normal and clipping_mode == gui.CLIPPING_MODE_STENCIL then
|
||||
return parent
|
||||
end
|
||||
|
||||
parent = gui.get_parent(parent)
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
--- Get node offset for given gui pivot
|
||||
-- @function helper.get_pivot_offset
|
||||
-- @tparam gui.pivot pivot The node pivot
|
||||
|
Reference in New Issue
Block a user