-
-
Notifications
You must be signed in to change notification settings - Fork 197
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 onSomethingDown callbacks #910
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @SirFurness! I'm not sure this is really needed on Clickable
though. onMouseDown
is already available on View
, which is what you'd typically use to implement something like this. I could see the value of having onRightMouseDown
for convenience if that was a really common need, but I don't think it is. Consequently this mostly just complicates the API I think. I'm certainly open for arguments to the contrary though.
~onDown: unit => unit=?, | ||
~onRightClick: unit => unit=?, | ||
~onRightDown: unit => unit=?, | ||
~onDoubleClick: unit => unit=?, | ||
~onDoubleDown: unit => unit=?, | ||
~onAnyClick: NodeEvents.mouseButtonEventParams => unit=?, | ||
~onAnyDown: NodeEvents.mouseButtonEventParams => unit=?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be onMouseDown
, onRightMouseDown
etc. to disambiguate it from for example onKeyDown
.
You're probably right that it's not a common need. I was mainly thinking in terms of future improvements to the I don't think any component should use I guess it depends on how the |
I'm honestly not really sure what
The mouse button is passed in the events args. That's how you're able to implement this. And this is analogous to how Left-only click, right click and double click is common enough that I think it warrants separate events, and they fit well with |
Sounds good! A document with some guiding design principles would be quite nice, especially with regards to big things like #489. |
Adds callbacks for the different clicks on mouse down.
This is useful for certain things like changing the position of the cursor in an
Input
component on mouse down.