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

The desktop pointer cursor is not representative of mobile #662

Merged
merged 8 commits into from
Aug 17, 2021

Conversation

eoghanmurray
Copy link
Contributor

The desktop pointer cursor is not representative of what is happening on a mobile device.

Instead, check a recording for any presence of a Touch event, and switch to a touch visualisation mode for the entire recording.
(for now, we use this mode even for mixed touch/mouse devices - this could be improved upon in future)

Show a round circle representing the users' finger which is visible only between TouchStart and TouchEnd events
Again this can be evolved upon, but this change should be a good start in the right direction.

…to index.ts from machine.ts (so they can be dealt with in bulk)
…o the last position so that it's in the correct place when the timer starts

 - previous `needCastInSyncMode` added in 4bf533a meant that the isSync versions of MouseMove/TouchMove were being accidentally ignored
 - each synchronous MouseMove would have resulted in a separate mouse position update
 - the Click/TouchStart/TouchEnd events didn't have an async version
@eoghanmurray eoghanmurray force-pushed the mobile-touch-visualisation branch from 97d42a0 to 44de72b Compare August 12, 2021 16:38
… on a mobile device.

Instead, check a recording for any presence of a Touch event, and switch to a touch visualisation mode for the entire recording.
(for now, we use this mode even for mixed touch/mouse devices - this could be improved upon in future)

Show a round circle representing the users' finger which is visible only between TouchStart and TouchEnd events
Again this can be evolved upon, but this change should be a good start in the right direction.
… as user can lift finger off screen and place elsewhere; however we can now have much smoother touch movement during the .touch-active phase as we know the finger is on the screen. This has a .25s delaying effect on the touch position which IMO is acceptable; e.g. scroll position can lag behind a touch movement and this seems to bring them more in sync
@eoghanmurray eoghanmurray force-pushed the mobile-touch-visualisation branch from 44de72b to 72bf5e1 Compare August 12, 2021 16:40
…n user has lifted their finger and placed it into a new position. This is apparent in a replay session where the user is scrolling the page using repeated TouchMove bottom-to-top movements
@@ -115,6 +123,8 @@ export class Replayer {

private newDocumentQueue: addedNodeMutation[] = [];

private mouseState: mouseState | null = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code to maintain this state looks a bit complex. Is it possible to use a getter to compute whenever need?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's supposed to be a lightweight object to hold mouse x/y and whether touch is active or not. The extra id (and debugData) is for moveAndHover.
It's only relevant during application of 'sync' events, to maintain a record of the last change to mouse state, and is cleared after each batch.
I'm not sure what a getter would achieve?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok actually some of the complexity comes from me trying to wrap two separate things into the same state object. I've separated them out in 5606987 and this should make things clearer.

@Yuyz0112 Yuyz0112 merged commit 9e226b5 into rrweb-io:master Aug 17, 2021
@Yuyz0112
Copy link
Member

Good Job!

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.

3 participants