Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 intomaster
base:master
Choose a base branch
Loading
fromwindow
Open

Improved input handling#228

aleclarson wants to merge12 commits intomasterfromwindow

Conversation

@aleclarson
Copy link
Collaborator

Add theRCTWindow class that improves upon the current input handling logic.

Users can opt-in by usingRCTWindow in place ofNSWindow. If they don't, they'll continue to use the (flawed)RCTTouchHandler logic.

Event handling inRCTWindow is different in the following ways:

  • SkiptouchStart events that target a focusedNSTextView

  • EmitmouseOut event when the mouse leaves theRCTWindow

  • EmittouchCancel event when a "touch" leaves theRCTWindow

  • SupportmouseMove events (which can be coalesced)

  • EmitmouseMove event right aftermouseUp events

  • Blur the focusedNSTextView when clicking outside it

  • SupportrightClick events

  • AddaltKey,ctrlKey,metaKey, andshiftKey properties to JS mouse events

  • UseconvertPoint:toView: to compute the relative mouse location

In the future, I might try updatingRCTTouchHandler with the same logic thatRCTWindow has. That's what I tried originally, but I ran into issues betweenNSGestureRecognizer andNSTextView.

Other changes

  • renamemouseEnter tomouseOver (to align with browsers)
  • renamemouseLeave tomouseOut (to align with browsers)

In the future, I might implement themouseEnter andmouseLeave events properly (using the JS event system).

The "mouseEnter" event in browsers does not bubble, while "mouseOver" does.
@aleclarsonaleclarsonforce-pushed thewindow branch 2 times, most recently from952a202 to778cd07CompareFebruary 19, 2019 19:10
Copy link
Owner

@ptmtptmt left a 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!

aleclarson reacted with heart emoji
@aleclarsonaleclarsonforce-pushed thewindow branch 2 times, most recently fromb347bbb to5a1de46CompareFebruary 23, 2019 16:29
The "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.
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.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ptmtptmtptmt approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

0.20.0

Development

Successfully merging this pull request may close these issues.

3 participants

@aleclarson@ptmt

[8]ページ先頭

©2009-2025 Movatter.jp