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

Prefer touch events to pointer events (fix android image editor) #5582

Merged
merged 1 commit into from
May 17, 2019

Conversation

jwunderl
Copy link
Member

@jwunderl jwunderl commented May 17, 2019

Fixes microsoft/pxt-arcade#379

Would be good to test on chromebook and physical android device / windows with touchscreen with a target build of arcade

Issue is that the browsers were using the pointer events when they should have been using touch events.

Broken / current:

2019-05-17 10 44 01

Fixed:

2019-05-17 10 43 11

testing:

  • chrome - mac, no touch screen
  • chrome - android emulator
  • firefox - mac
  • safari - mac
  • safari - ipad simulator
  • chrome - android hardware
  • [ ] chrome - touchscreen on chromebook don't have a touchscreen chromebook but should match android?
  • chrome - touchscreen on windows
  • edge - touchscreen on windows
  • firefox - touchscreen on windows

@jwunderl jwunderl requested a review from riknoll May 17, 2019 17:46
@jwunderl jwunderl changed the title prefer touch events to pointer events (fix android image editor) Prefer touch events to pointer events (fix android image editor) May 17, 2019
@jwunderl
Copy link
Member Author

Works on all the above except for edge; edge seems to be ignoring the stopPropogation on drag events and treating the left / right touch drags like forward / back browser buttons. (exact same behavior as current live site, except maybe a tiny bit better in that you can draw upwards and downwards)

@riknoll
Copy link
Member

riknoll commented May 17, 2019

@jwunderl you probably need to call e.preventDefault()

@jwunderl
Copy link
Member Author

Oops, yeah said the wrong one; that should be being called in the drag as well though:

private moveHandler = (ev: MouseEvent) => {
const [col, row] = this.clientEventToCell(ev);
if (col >= 0 && row >= 0 && col < this.image.width && row < this.image.height) {
if (ev.buttons & 1) {
this.gesture.handle(InputEvent.Down, col, row);
}
this.gesture.handle(InputEvent.Move, col, row);
}
ev.stopPropagation();
ev.preventDefault();
}

@jwunderl jwunderl merged commit 4567c13 into master May 17, 2019
@jwunderl jwunderl deleted the fixAndroidImageEditor branch May 17, 2019 21:07
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image editor on android not drawing properly
2 participants