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:
@@ -18,7 +18,7 @@ local const = require("druid.const")
|
||||
local helper = require("druid.helper")
|
||||
local component = require("druid.component")
|
||||
|
||||
local Hover = component.create("hover", { component.ON_INPUT })
|
||||
local Hover = component.create("hover", { component.ON_INPUT, component.ON_LATE_INIT })
|
||||
|
||||
|
||||
--- Component init function
|
||||
@@ -38,6 +38,16 @@ function Hover.init(self, node, on_hover_callback)
|
||||
end
|
||||
|
||||
|
||||
function Hover.on_late_init(self)
|
||||
if not self.click_zone and const.IS_STENCIL_CHECK then
|
||||
local stencil_node = helper.get_closest_stencil_node(self.node)
|
||||
if stencil_node then
|
||||
self:set_click_zone(stencil_node)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function Hover.on_input(self, action_id, action)
|
||||
if action_id ~= const.ACTION_TOUCH and action_id ~= nil then
|
||||
return false
|
||||
|
Reference in New Issue
Block a user