'moves' are not 'taps'
This commit is contained in:
86
src/onTap.js
86
src/onTap.js
@@ -50,28 +50,61 @@ export default class OnTap {
|
||||
console.log('mousedown', event);
|
||||
}
|
||||
|
||||
touchstart(event) {
|
||||
if (!this.state.clickStartTime) {
|
||||
this.state.clickStartX = event.pageX;
|
||||
this.state.clickStartY = event.pageY;
|
||||
this.state.clickStartTime = event.timeStamp;
|
||||
}
|
||||
|
||||
console.log('touchstart', event);
|
||||
}
|
||||
|
||||
mouseup(event) {
|
||||
if (this.state.clickStartTime) {
|
||||
|
||||
if (!this.state.moving) {
|
||||
console.log('mouseup', event);
|
||||
this.actions.tap.callback(event);
|
||||
}
|
||||
else {
|
||||
console.log({
|
||||
duration: event.timeStamp - this.state.clickStartTime,
|
||||
deltaX: event.pageX - this.state.clickStartX,
|
||||
deltaY: event.pageY - this.state.clickStartY
|
||||
});
|
||||
|
||||
this.state.moving = null;
|
||||
this.state.lastX = null;
|
||||
this.state.lastY = null;
|
||||
this.state.clickStartX = null;
|
||||
this.state.clickStartY = null;
|
||||
this.state.clickStartTime = null;
|
||||
}
|
||||
|
||||
console.log('mouseup', event);
|
||||
this.actions.tap.callback(event);
|
||||
this.state.moving = null;
|
||||
this.state.lastX = null;
|
||||
this.state.lastY = null;
|
||||
this.state.clickStartX = null;
|
||||
this.state.clickStartY = null;
|
||||
this.state.clickStartTime = null;
|
||||
}
|
||||
|
||||
touchend(event) {
|
||||
|
||||
if (!this.state.moving) {
|
||||
console.log('touchend', event);
|
||||
this.actions.tap.callback(event);
|
||||
}
|
||||
else {
|
||||
console.log({
|
||||
duration: event.timeStamp - this.state.clickStartTime,
|
||||
deltaX: event.pageX - this.state.clickStartX,
|
||||
deltaY: event.pageY - this.state.clickStartY
|
||||
});
|
||||
}
|
||||
|
||||
this.state.moving = null;
|
||||
this.state.lastX = null;
|
||||
this.state.lastY = null;
|
||||
this.state.clickStartX = null;
|
||||
this.state.clickStartY = null;
|
||||
this.state.clickStartTime = null;
|
||||
}
|
||||
|
||||
mousemove(event) {
|
||||
// console.log('mousemove', event);
|
||||
|
||||
if (this.state.clickStartTime) {
|
||||
if (!this.state.moving) {
|
||||
@@ -94,38 +127,7 @@ export default class OnTap {
|
||||
}
|
||||
}
|
||||
|
||||
touchstart(event) {
|
||||
if (!this.state.clickStartTime) {
|
||||
this.state.clickStartX = event.pageX;
|
||||
this.state.clickStartY = event.pageY;
|
||||
this.state.clickStartTime = event.timeStamp;
|
||||
}
|
||||
|
||||
console.log('touchstart', event);
|
||||
}
|
||||
|
||||
touchend(event) {
|
||||
if (this.state.clickStartTime) {
|
||||
console.log({
|
||||
duration: event.timeStamp - this.state.clickStartTime,
|
||||
deltaX: event.pageX - this.state.clickStartX,
|
||||
deltaY: event.pageY - this.state.clickStartY
|
||||
});
|
||||
|
||||
this.state.moving = null;
|
||||
this.state.lastX = null;
|
||||
this.state.lastY = null;
|
||||
this.state.clickStartX = null;
|
||||
this.state.clickStartY = null;
|
||||
this.state.clickStartTime = null;
|
||||
}
|
||||
|
||||
console.log('touchend', event);
|
||||
this.actions.tap.callback(event);
|
||||
}
|
||||
|
||||
touchmove(event) {
|
||||
// console.log('touchmove', event);
|
||||
|
||||
if (this.state.clickStartTime) {
|
||||
if (!this.state.moving) {
|
||||
|
||||
Reference in New Issue
Block a user