-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[WIP] Add onMouseMove method; Fix incorrect selection when click and drag move #2104
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2104 +/- ##
==========================================
- Coverage 69.54% 69.42% -0.12%
==========================================
Files 73 73
Lines 5437 5446 +9
==========================================
Hits 3781 3781
- Misses 1656 1665 +9
Continue to review full report at Codecov.
|
Hey @zhujinxuan, this sounds like a good call. Can you explain exactly what's going on here in terms of the events that are firing in the browser? I'm not sure I understand. |
@ianstormtaylor Sometimes, when you press and drag from a empty block start. The browser will fire onSelection events with collapsed selection, rather than selection extended from the mouse down selection. (#1969) This PR tries to fix the problem that, for any |
@zhujinxuan is this something that other editors experience? I remember someone mentioning that the reason this happens might be due to the zero-width spaces. But in #1969 it sounds like there might even be cases where this happens without the zero-width spaces? I'd like to have more research before we merge this, because having a constant timeout timer for any mouse movements (with a magic |
@ianstormtaylor I can only reproduce it in the slate. I can only reproduce #1969 (comment) but unable to reproduce #1969 (comment). (only able to reproduce the zero-width condition but not the second one). Can we just change this PR to add onMouseMove handlers (without adding the timer to the core)? |
@ianstormtaylor BTW, the timer is initialized only on (pressed & mouse move). Because the setTimeout is called only when (event.buttons % 2 == 1) (which means left mouse button is pressed) But I agree that the timer solution is an ugly solution. |
95fe4ba
to
9c0a777
Compare
ccb247c
to
27f0084
Compare
Will use another PR to fix the problem |
Is this adding or improving a feature or fixing a bug?
bug
What's the new behavior?
If user click and drag, and an selection event is fired during dragging. Then we shall expect an extended range instead of an collapsed range. When the browser accidentally causes an collapsed range, then we shall extend it to the new selection instead of select.
Have you checked that...?
yarn test
.yarn lint
. (Fix errors withyarn prettier
.)yarn watch
.)Does this fix any issues or need any specific reviewers?
Fixes: #1969
Reviewers: @