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

Versions of hover, drag, tap which pass the mouse position and button. #57

Merged
merged 3 commits into from
Dec 10, 2023

Conversation

ruza-net
Copy link
Contributor

@ruza-net ruza-net commented Dec 9, 2023

Added modifiers hover_p, drag_p, tap_p which pass the mouse position and button, where applicable.

@wtholliday
Copy link
Contributor

Hey thanks! Could we modify the existing structs to take a closure with position instead of having new structs with mostly duplicate code?

@wtholliday
Copy link
Contributor

I tried this:

    /// Calls a function in response to a tap.
    fn tap<A: 'static, F: Fn(&mut Context) -> A + 'static, F2: Fn(&mut Context, LocalPoint, Option<MouseButton>) -> A + 'static>(self, f: F) -> Tap<Self, F2> {
        Tap::new(self, move |cx, _, _ | f(cx))
    }

    fn tap_p<A: 'static, F: Fn(&mut Context, LocalPoint, Option<MouseButton>) -> A + 'static>(self, f: F) -> Tap<Self, F> {
        Tap::new(self, f)
    }

But the closure doesn't match the type:

image

@wtholliday wtholliday merged commit f64d803 into audulus:main Dec 10, 2023
2 checks passed
@ruza-net
Copy link
Contributor Author

It's an interesting idea, maybe I can get it to work somehow...

@wtholliday
Copy link
Contributor

@ruza-net I figured it out after merging this one :)

#58

and subsequent commits

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.

2 participants