Skip to content

Commit

Permalink
fix(FEC-11933): if seek with the mouse, the scrubber position doesn't…
Browse files Browse the repository at this point in the history
… match with the cursor (#658)

the seekbar moved (#653) into the bottom bar area so need to take the offset from its parent

Solves FEC-11933
  • Loading branch information
yairans authored Feb 1, 2022
1 parent 71f5934 commit eba00e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/seekbar/seekbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,10 @@ class SeekBar extends Component {
const xPosition = typeof e.clientX === 'number' ? e.clientX : e.changedTouches && e.changedTouches[0] && e.changedTouches[0].clientX;
let time =
this.props.duration *
((xPosition - this._seekBarElement.offsetLeft - this.getOffset(this.props.playerElement).left) / this._seekBarElement.clientWidth);
((xPosition -
(this._seekBarElement.offsetParent instanceof HTMLElement ? this._seekBarElement.offsetParent.offsetLeft : 0) -
this.getOffset(this.props.playerElement).left) /
this._seekBarElement.clientWidth);
time = parseFloat(time.toFixed(2));
if (time < 0) {
return 0;
Expand Down

0 comments on commit eba00e0

Please sign in to comment.