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

Add touch support. Replaces PR #67 #82

Open
wants to merge 5 commits into
base: feature/canvas-ext
Choose a base branch
from
Open

Add touch support. Replaces PR #67 #82

wants to merge 5 commits into from

Conversation

joancc
Copy link

@joancc joancc commented Nov 27, 2020

@antonioru I began this from the new Constants.js file you created for feature/canvas.

const getMouseEventPoint = (e) => ({ x: e.pageX, y: e.pageY });
const getTouchEventPoint = (e) => getMouseEventPoint(e.changedTouches[0]);
export const getEventPoint = isTouch ? getTouchEventPoint : getMouseEventPoint;

This now exposes the event point as an object instead of the usual array. I do like this as it's more explicit. However I started running into places where the array was still expected. I took the liberty of updating those areas to create/refer to an {x, y} object instead. Let me know if this makes sense or you'd rather revert to the [x, y] option.

*On another note I did notice that dragging the new canvas, creates a scroll. I had tackled something similar in the original PR #67 with touch-action: none; inside diagram.scss. But since you're still working on the canvas feature, didn't want to try and address.

Description

Add touch support for:

  1. Dragging nodes
  2. Dragging segments from nodes
  3. Creating segments on touchend at new port

Related Issue

Closes #60 and replaces PR #67

Motivation and Context

Closes #60

How Has This Been Tested?

All existing tests are passing.
Tested on the Chrome mobile simulator on a mac and Safari on an iPad.

@joancc joancc mentioned this pull request Nov 27, 2020
@joancc joancc changed the base branch from feature/canvas to feature/canvas-ext November 28, 2020 23:56
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.

None yet

3 participants