Permalink
Browse files

fix: being able to toggle playback with middle click (#4756)

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 7a776eeeea5d0716210cbb60ef95ebe0437bddd7
Showing with 9 additions and 9 deletions.
  1. +9 −9 src/js/player.js
View
@@ -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();
}
}

0 comments on commit 7a776ee

Please sign in to comment.