-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: allow setting key, touch and mouse event handlers #7
Conversation
Edit: I think I have to change this, I did not see the event listeners that were added to the document @mnogueron Could you please explain why you choose to add the event listeners for mousedown ad mouseup to the document instead of adding those via the props? react-easy-panzoom/src/PanZoom.js Lines 416 to 423 in 7ed8238
|
The reason to set the listener on the document and not on the actual component via props is that you still want to catch events when the mouse is leaving the component boundaries. |
@n1ru4l I would rather see a use of deconstructing props, to pass down the rest of the props given to the |
Sure let's do it like that! |
7ed8238
to
e130ef0
Compare
@mnogueron Done 😊 |
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.
@n1ru4l Sweat modifications!
Just same small comments but overwise it's good to go 🙂
d42aa40
to
55df3f7
Compare
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.
@n1ru4l Perfect! Just need to fix the merge issue and it's good to go! :)
18b19ea
to
a56a5b9
Compare
@mnogueron Done! |
The project I am working on requires adding event listeners to the PanZoom component.
Ideally, this project would use prop getters (https://kentcdodds.com/blog/how-to-give-rendering-control-to-users-with-prop-getters). However, this is something to consider for a major release/braking change.
This implementation uses a list of allowed event property names in order to apply them from either the component instance methods or the props passed to the component instance.