Skip to content

Commit

Permalink
fix: isPressed will be consedered PointerEvent on iOS13
Browse files Browse the repository at this point in the history
  • Loading branch information
umeruma committed Oct 2, 2019
1 parent 390c356 commit dc9ded1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
35 changes: 35 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const angle = (p1, p2) => {
};

export const findCoord = (p, d, a) => {
const b = {x: 0, y: 0};
const b = { x: 0, y: 0 };
a = radians(a);
b.x = p.x - d * Math.cos(a);
b.y = p.y - d * Math.sin(a);
Expand All @@ -33,6 +33,9 @@ export const degrees = (a) => {
};

export const isPressed = (evt) => {
if (evt.type === 'pointerdown' || evt.type === 'pointermove') {
return true;
}
if (isNaN(evt.buttons)) {
return evt.pressure !== 0;
}
Expand Down

0 comments on commit dc9ded1

Please sign in to comment.