#299 fixed mouse events passing to hidden elements

This commit is contained in:
Mikayla Fischler 2023-07-29 00:25:20 -04:00
parent 9f8732830c
commit b3c7263bc4
2 changed files with 12 additions and 9 deletions

View File

@ -7,7 +7,7 @@ local flasher = require("graphics.flasher")
local core = {}
core.version = "1.0.2"
core.version = "1.0.3"
core.flasher = flasher
core.events = events

View File

@ -20,6 +20,7 @@ local element = {}
---@alias graphics_args graphics_args_generic
---|waiting_args
---|app_button_args
---|checkbox_args
---|hazard_button_args
---|multi_button_args
@ -515,9 +516,10 @@ function element.new(args, child_offset_x, child_offset_y)
-- FUNCTION CALLBACKS --
-- handle a monitor touch or mouse click
-- handle a monitor touch or mouse click if this element is visible
---@param event mouse_interaction mouse interaction event
function public.handle_mouse(event)
if protected.window.isVisible() then
local x_ini, y_ini = event.initial.x, event.initial.y
local ini_in = protected.in_window_bounds(x_ini, y_ini)
@ -530,6 +532,7 @@ function element.new(args, child_offset_x, child_offset_y)
for _, child in pairs(protected.children) do child.handle_mouse(event_T) end
end
end
end
-- draw the element given new data
---@vararg any new data