- Notifications
You must be signed in to change notification settings - Fork426
Improved input handling#228
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
aleclarson wants to merge12 commits intomasterChoose a base branch fromwindow
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Open
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
The "mouseEnter" event in browsers does not bubble, while "mouseOver" does.
952a202 to778cd07Compareptmt approved these changesFeb 23, 2019
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.
I love that, thanks for a huge amount of effort!
Uh oh!
There was an error while loading.Please reload this page.
b347bbb to5a1de46CompareThe "mouseLeave" event in browsers does not bubble, while "mouseOut" does.
By subclassing NSWindow and overriding the "sendEvent:" method, we can avoid using the NSGestureRecognizer class, which seems to cause issues with NSTextView event handling.The RCTWindow class reimplements input event handling, which solves the following issues: - Skip "touchStart" events that target a focused NSTextView - Emit "mouseOut" event when the mouse leaves the RCTWindow - Emit "touchCancel" when the mouse leaves the RCTWindow - Support "mouseMove" events (which can be coalesced) - Emit "mouseMove" event right after "mouseUp" events - Blur the focused NSTextView when clicking outside it - Support "contextMenu" events - Add "altKey", "ctrlKey", "metaKey", and "shiftKey" properties to JS mouse events - Use "convertPoint:toView:" to compute the relative mouse location
These new calculations match the UIManager#measure method.
This was referencedMar 14, 2019
The RCTRootContentView "hitTest:" method now flips the Y-axis of whatever point is passed to it, instead of relying on the caller to do it.Also, the `passThroughTouches` property of RCTRootView now works as expected.
This was referencedApr 11, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the
RCTWindowclass that improves upon the current input handling logic.Users can opt-in by using
RCTWindowin place ofNSWindow. If they don't, they'll continue to use the (flawed)RCTTouchHandlerlogic.Event handling in
RCTWindowis different in the following ways:Skip
touchStartevents that target a focusedNSTextViewEmit
mouseOutevent when the mouse leaves theRCTWindowEmit
touchCancelevent when a "touch" leaves theRCTWindowSupport
mouseMoveevents (which can be coalesced)Emit
mouseMoveevent right aftermouseUpeventsBlur the focused
NSTextViewwhen clicking outside itSupport
rightClickeventsAdd
altKey,ctrlKey,metaKey, andshiftKeyproperties to JS mouse eventsUse
convertPoint:toView:to compute the relative mouse locationIn the future, I might try updating
RCTTouchHandlerwith the same logic thatRCTWindowhas. That's what I tried originally, but I ran into issues betweenNSGestureRecognizerandNSTextView.Other changes
mouseEntertomouseOver(to align with browsers)mouseLeavetomouseOut(to align with browsers)In the future, I might implement the
mouseEnterandmouseLeaveevents properly (using the JS event system).