Skip to content
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

Allow disable() mid-drag (#2419) #5486

Closed
wants to merge 12 commits into from

Conversation

krabbypattified
Copy link

This code allows the user to call dragPan.disable() mid-drag.
This is intended as a fix for touch (mobile) devices.
It enables draggable markers on touch devices.

Allows the user to call map.dragPan.disable() mid-drag.
This enables draggable markers on mobile devices.
@mollymerp
Copy link
Contributor

@krabbypattified thanks for your contribution! the tests are failing because of linting errors right now. you can fix this by running yarn lint --fix or npm run lint -- --fix.

do you have a test case that you used to manually determine if this fix was working? I can investigate adding a unit test to test this fix as well.

@krabbypattified
Copy link
Author

krabbypattified commented Oct 27, 2017

@mollymerp I've added a test for my code, but since there's no simulation.touch events, I wasn't able to include touch tests.

I've run yarn lint --fix which has come back with no errors. Granted, I did copy/paste from my local Atom files into the GitHub online commit system.

@krabbypattified
Copy link
Author

Why is Flow doing this to me?
if (e.touches) return this._onTouchEnd(e); ^ MouseEvent. This type is incompatible with the expected param type of 195: _onTouchEnd(e: TouchEvent)

@mollymerp
Copy link
Contributor

Ooo @krabbypattified sorry for the delay here. What's happening is that since you're not explicitly ensuring that e is of type TouchEvent before invoking _onTouchEnd flow thinks that the e passed to _onTouchEnd could possibly be of type MouseEvent.

I belive you can get rid of this error by changing your condition on L111 from if (e.touches) to if (e instanceof TouchEvent)

@jfirebaugh
Copy link
Contributor

Thanks for the contribution @krabbypattified, and sorry that we weren't more responsive on this PR. It got overtaken by other event-related work, so I've opened an alternative fix for the issue in #6232.

@jfirebaugh jfirebaugh closed this Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants