Skip to content

Commit

Permalink
fix(events): skipped touchstart event (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-rr committed Mar 12, 2022
1 parent 5b49dc3 commit 4a878f0
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 8 deletions.
7 changes: 6 additions & 1 deletion dist/cupertino-pane.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Released under the MIT License
*
* Released on: February 21, 2022
* Released on: March 13, 2022
*/

/*! *****************************************************************************
Expand Down Expand Up @@ -389,6 +389,11 @@ class Events {
touchMove(t) {
var _a;
const { clientY, clientX, velocityY } = this.getEvetClientYX(t, 'touchmove');
// sometimes touchstart is not called
// when touchmove is began before initialization
if (!this.steps.length) {
this.steps.push({ posY: clientY, time: Date.now() });
}
// Event emitter
t.delta = ((_a = this.steps[0]) === null || _a === void 0 ? void 0 : _a.posY) - clientY;
this.settings.onDrag(t);
Expand Down
4 changes: 2 additions & 2 deletions dist/cupertino-pane.esm.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cupertino-pane.esm.min.js.map

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion dist/cupertino-pane.js

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

1 change: 1 addition & 0 deletions dist/cupertino-pane.js.map

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

4 changes: 2 additions & 2 deletions dist/cupertino-pane.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cupertino-pane.min.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ export class Events {
private touchMove(t) {
const { clientY, clientX, velocityY } = this.getEvetClientYX(t, 'touchmove');

// sometimes touchstart is not called
// when touchmove is began before initialization
if (!this.steps.length) {
this.steps.push({posY: clientY, time: Date.now()});
}

// Event emitter
t.delta = this.steps[0]?.posY - clientY;
this.settings.onDrag(t);
Expand Down

0 comments on commit 4a878f0

Please sign in to comment.