Closed Keyslam closed 1 year ago
From a discussion in the LÖVE Discord server:
Simple parent-child relations will be by far the most common pattern when using Inky, so it's a bit silly to constantly have to do depth + 1
.
Inky should track the current hierarchy's depth, and if no depth is passed to the render function, automatically put in depth + 1
.
Sometimes a parent element might want to know when a (grand)child element accepted an event: Lets say you have a window thats unfocused with a button in it. When you click the button both should activate, but the window should also take focus.
For this I propose:
context:onPointerInHierarchy(name, function(pointer)
end)
context:onPointerEnterHierarchy(function(pointer)
end)
If a pointer event is emitted at a point where multiple elements are overlapping, the event will be sent to all of the elements. In some cases, events should be able to be consumed: A window might consume any clicks, such that a window below won't be focused. To enable this, a sense of "depth" is also required.
I propose the following changes:
Context:onPointer
andContext:onPointerEnter
can returntrue
to indicate the event was consumed. It will not be passed to other elements then.