Skip to content

Commit

Permalink
fix: play/pause click on 360 content is too sensitive (#246)
Browse files Browse the repository at this point in the history
add a threshold of 5 to consider minor movement as click and not as dragging
  • Loading branch information
yairans authored Jun 21, 2018
1 parent d258c11 commit 3346024
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/overlay-action/overlay-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ const PLAY_PAUSE_BUFFER_TIME: number = 200;
*/
const DOUBLE_CLICK_MAX_BUFFER_TIME: number = 500;

/**
* The maximum distance between 'pointerdown' point and 'pointerup' point to still be considered as click and not as dragging
* @type {number}
* @const
*/
const DRAGGING_THRESHOLD: number = 5;

@connect(mapStateToProps, bindActions(Object.assign(actions, shellActions)))
/**
* OverlayAction component
Expand Down Expand Up @@ -167,7 +174,7 @@ class OverlayAction extends BaseComponent {
clientX: event.clientX || event.changedTouches[0] && event.changedTouches[0].clientX,
clientY: event.clientY || event.changedTouches[0] && event.changedTouches[0].clientY
};
return (Math.abs(points.clientX - this._pointerDownPosX) > 1 || Math.abs(points.clientY - this._pointerDownPosY) > 1);
return (Math.abs(points.clientX - this._pointerDownPosX) > DRAGGING_THRESHOLD || Math.abs(points.clientY - this._pointerDownPosY) > DRAGGING_THRESHOLD);
}

/**
Expand Down

0 comments on commit 3346024

Please sign in to comment.