Handle events in children before parents

This commit is contained in:
Gabriel Tofvesson 2024-10-12 00:41:26 +02:00
parent 63e1e54462
commit 1a63a7054f

View File

@ -122,10 +122,6 @@ function Children:with(elementType)
end end
function elementType:handleEvent(evt) function elementType:handleEvent(evt)
if Element.handleEvent(self, evt) then
return true
end
local evtLocalCoords = Event.toElementLocalPosition(evt, self) local evtLocalCoords = Event.toElementLocalPosition(evt, self)
if Event.isClickEvent(evt) then if Event.isClickEvent(evt) then
@ -139,15 +135,15 @@ function Children:with(elementType)
return true return true
end end
end end
return false
else else
for _,child in self:_iterateChildren() do for _,child in self:_iterateChildren() do
if child:handleEvent(evtLocalCoords) then if child:handleEvent(evtLocalCoords) then
return true return true
end end
end end
return false
end end
return Element.handleEvent(self, evt)
end end
return elementType return elementType