Skip to main content

correct_transformed_interactions

Function correct_transformed_interactions 

Source
pub fn correct_transformed_interactions(
    state: Option<Res<'_, Transform3dPointer>>,
    hover_map: Option<Res<'_, HoverMap>>,
    pointers: Query<'_, '_, (&PointerId, &PointerPress, &PointerLocation)>,
    windows: Query<'_, '_, &Window, With<PrimaryWindow>>,
    membership: Res<'_, LayerMembership>,
    matrices: Query<'_, '_, &LayerTransform3dMatrix>,
    child_of: Query<'_, '_, &ChildOf>,
    interactions: Query<'_, '_, (Entity, &mut Interaction, Option<&mut RelativeCursorPosition>, Option<&ComputedNode>, Option<&UiGlobalTransform>)>,
)
Expand description

Re-derive the legacy Interaction — and RelativeCursorPosition — for members of visually-transformed layers from the virtual pointer (HoverMap entry + press state + remapped location). ui_focus_system computes both geometrically from the real cursor against the stale layout rect (suppress_transformed_layer_hits never reaches it), so without this the real pointer lights hover/press styling — and reports drag positions — where layout put the subtree, not where it renders. Runs before apply_interaction_styles/collect_hover_events/ collect_pointer_events so styling, enter/leave, and onPointer* positions all see the corrected state.