Skip to content

Commit

Permalink
fix: being able to toggle playback with middle click (#4756)
Browse files Browse the repository at this point in the history
Uses the new Dom.isSingleLeftClick method to do the check we were doing previously.
Also, refactor the player.handleTechClick_() method to follow the new style of code.

Fixes #4689
  • Loading branch information
kocoten1992 authored and gkatsev committed Nov 17, 2017
1 parent 1fcd5ae commit 7a776ee
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1430,20 +1430,20 @@ class Player extends Component {
* @private
*/
handleTechClick_(event) {
// We're using mousedown to detect clicks thanks to Flash, but mousedown
// will also be triggered with right-clicks, so we need to prevent that
if (event.button !== 0) {
if (!Dom.isSingleLeftClick(event)) {
return;
}

// When controls are disabled a click should not toggle playback because
// the click is considered a control
if (this.controls()) {
if (this.paused()) {
this.play();
} else {
this.pause();
}
if (!this.controls_) {
return;
}

if (this.paused()) {
this.play();
} else {
this.pause();
}
}

Expand Down

0 comments on commit 7a776ee

Please sign in to comment.