Skip to content

Commit

Permalink
fix: 🐛 Fix issue videogular#810, seekbar doesn't go crazy when cursor…
Browse files Browse the repository at this point in the history
… out

Fix issue videogular#810, seekbar doesn't go crazy when cursor is sliding the
seekbar and gets out of the player. Instead getting offsetX, now get the
cursor x coordinate and calculates its position relative to the
scrub-bar to calculate the correct position.

BREAKING CHANGE: 🧨 none

✅ Closes: videogular#810
  • Loading branch information
pyrextor committed Mar 18, 2021
1 parent c38a577 commit 363e470
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controls/vg-scrub-bar/vg-scrub-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ export class VgScrubBar implements OnInit, OnDestroy {
onMouseMoveScrubBar($event: any) {
if (this.target) {
if (!this.target.isLive && this.vgSlider && this.isSeeking) {
this.seekMove($event.offsetX);
const dif = (((window.innerWidth - this.elem.offsetWidth)/2)).toFixed(0);
this.seekMove(Number($event.clientX) - Number(dif));
}
}
}
Expand All @@ -187,7 +188,8 @@ export class VgScrubBar implements OnInit, OnDestroy {
onMouseUpScrubBar($event: any) {
if (this.target) {
if (!this.target.isLive && this.vgSlider && this.isSeeking) {
this.seekEnd($event.offsetX);
const dif = (((window.innerWidth - this.elem.offsetWidth)/2)).toFixed(0);
this.seekEnd(Number($event.clientX) - Number(dif));
}
}
}
Expand Down

0 comments on commit 363e470

Please sign in to comment.