Skip to content

Adds support for touch events, enabling touch dragging the canvas #828

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

Merged
merged 3 commits into from
Jul 11, 2021

Conversation

renato-bohler
Copy link
Contributor

@renato-bohler renato-bohler commented Apr 12, 2021

Checklist

  • The code has been run through pretty yarn run pretty
  • The tests pass on CircleCI
  • You have referenced the issue(s) or other PR(s) this fixes/relates-to
  • The PR Template has been filled out (see below)
  • Had a beer/coffee coke because you are awesome

What?

Adds support for touch events (touchstart, touchmove and touchend). Enables touch dragging the canvas by default.

P.S.: this is already working on logossim, changes applied using patch-package on this PR: renato-bohler/logossim#59

Example:

Peek.2021-04-11.21-10.mp4

Why?

Improves mobile support. Even though it doesn't completely makes touch-based devices supported, this makes it possible for developers to implement full support on their applications (by customizing State).

How?

  1. Added 3 touch events to InputType.
  2. Changed getActionsForEvent method on ActionEventBus.
  3. Changed AbstractDisplacementState to listen for touch events.
  4. Added onTouch(Start/End/Move) event handlers on CanvasWidget.
  5. Updated the DefaultState.
  6. Updated examples.

Feel good image:

image

@renato-bohler
Copy link
Contributor Author

This is a mini version of #488 that only enables dragging. The advantage is that this PR could be shipped more easily. Maybe we could work on node dragging/link creation on future versions.

@kobajs
Copy link
Contributor

kobajs commented May 4, 2021

I need that 👍

@dylanvorster dylanvorster merged commit be42243 into projectstorm:master Jul 11, 2021
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