Closed tychedelia closed 6 months ago
I was able to solve this by making my "parent" a sibling of my children and having a non-pickable root parent. Moving the false sibling "parent" updates the root parent which modifies the child global transform. 👍
Sometimes, it's useful to be able to effect child entities independently of a parent, while still benefiting from things like transform propagation of their parent.
For example, both parent and child might have
On::<Pointer<Drag>>
components. With event bubbling, this means that moving a child will additionally cause it to be moved relative to it's parent's transform when the parent's drag even handler fires.There are two solutions I've tried implementing, both of which require manually implementing
EntityEvent
:Add a generic parameter to
Pointer
which controls the return value ofcan_bubble
, egOn::<Pointer<Drag, NoBubble>>
.Add some kind of method like
stop_propagation
toPointer
which the user can call insiderun
.Personally, I kind of favor 1, since it plays more nicely with
On
components that don't provide mutable access to the underlying event.