Skip to content

Add event for clicks #9047

@Shatur

Description

@Shatur

What problem does this solve or what need does it fill?

Recently we renamed Interaction::Click into Interaction::Pressed and it makes a lot of sense. But we still don't have mechanism for actual clicks. It's different from button press: it's a transition from pressed and released state when the cursor stays on the button.

What solution would you like?

I would suggest to introduce event struct Click(Entity) event that contains the clicked entity.

Additional context

It's very simple to implement, here is the implementation from my game. The event happens on transition from Interaction::Clicked to Interaction::Hovered, you don't even need to check the mouse position, Interaction::Hovered gives it's to you for free.

If we implement it, we need to change the example to check for click instead of button press.

@AnthonyKalaitzis you may be interested in implementing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-PickingPointing at and selecting objects of all sortsA-UIGraphical user interfaces, styles, layouts, and widgetsC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions