Solve #214 Fix hover on_input return value. Add hover example. Add hover_instance to hover callback

This commit is contained in:
Insality
2022-12-03 16:26:28 +02:00
parent d93823ae6a
commit 8fb41ea8e9
6 changed files with 401 additions and 4 deletions

View File

@@ -5,10 +5,10 @@
-- @within BaseComponent
-- @alias druid.hover
--- On hover callback(self, state)
--- On hover callback(self, state, hover_instance)
-- @tfield DruidEvent on_hover @{DruidEvent}
--- On mouse hover callback(self, state)
--- On mouse hover callback(self, state, hover_instance)
-- @tfield DruidEvent on_mouse_hover @{DruidEvent}
---
@@ -81,6 +81,8 @@ function Hover.on_input(self, action_id, action)
else
hover_function(self, true)
end
return false
end
@@ -95,7 +97,7 @@ end
function Hover.set_hover(self, state)
if self._is_hovered ~= state then
self._is_hovered = state
self.on_hover:trigger(self:get_context(), state)
self.on_hover:trigger(self:get_context(), state, self)
end
end
@@ -105,7 +107,7 @@ end
function Hover.set_mouse_hover(self, state)
if self._is_mouse_hovered ~= state then
self._is_mouse_hovered = state
self.on_mouse_hover:trigger(self:get_context(), state)
self.on_mouse_hover:trigger(self:get_context(), state, self)
end
end