Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to MouseArea new functions to emit messages containing the position on press and release events. #2784

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

IohannRabeson
Copy link

This PR allow to emit messages containing the cursor position when the user press and release mouse buttons in a MouseArea.

Currently you have to use MouseArea::on_move and cache the position received.
Now all you need is to declare a message that stores a Point.

Example of usage:

enum Message {
    Click(Point)
}

MouseArea::new(text("Hey"))
            .on_press_position(Message::Click)
            .into()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant