-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(ripple): handle touch events #7927
feat(ripple): handle touch events #7927
Conversation
if (!this.rippleDisabled) { | ||
this._isMousedown = true; | ||
const isSyntheticEvent = this._lastTouchStartEvent && | ||
Date.now() < this._lastTouchStartEvent + ignoreMouseEventsTimeout; |
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.
Rather than using the Date.now()
, you should be able to take the Event.timeStamp
. I'm not completely sure about the browser support though, you may have to double check.
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.
As discussed on Slack, for browser compatibility we'll be using Date.now()
* Timeout for ignoring mouse events. Mouse events will be temporary ignored after touch | ||
* events to avoid synthetic mouse events. | ||
*/ | ||
const ignoreMouseEventsTimeout = 800; |
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.
This seems a little high. Wasn't the timeout 300ms?
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.
On Polymer it's 2000ms IIRC and in Materialize it's 500. On Material 1.x we used 650ms as a touch buffer for the interaction service. 800ms should be fine, and it doesn't really matter that much anyway.
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.
The const name here should be uppercased to match the others' naming.
/** Whether the mouse is currently down or not. */ | ||
private _isMousedown: boolean = false; | ||
/** Whether the pointer is currently down or not. */ | ||
private _isPointerDown: boolean = false; |
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.
The boolean
typing here is redundant.
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.
Done.
60d6019
to
f479940
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.
LGTM
* Timeout for ignoring mouse events. Mouse events will be temporary ignored after touch | ||
* events to avoid synthetic mouse events. | ||
*/ | ||
const ignoreMouseEventsTimeout = 800; |
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.
The const name here should be uppercased to match the others' naming.
fa7e647
to
62109ab
Compare
@devversion lint error
|
@devversion which devices did you test on? We have pretty much everything in the office |
* Now handles touch events properly. Fixes angular#7062
@jelbourn I tested it on a few browsers. Mostly desktop browsers. Chrome 62 (Win), Firefox 57 (Win), Edge, IE11, Safari 11, Chrome 62 (MacOS) and Chrome 62 (Android 7.0) |
62109ab
to
e72592d
Compare
I'd like to double check on a few devices before merging |
* Now handles touch events properly. Fixes angular#7062
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Note: Tested it thoroughly already and it works great. Still want to test on more devices manually to make sure it works fine!
Fixes #7062