Fix scrub for safari

This commit is contained in:
morethanwords 2020-09-01 17:08:23 +03:00
parent 88862f22df
commit c83c377e38

View File

@ -88,11 +88,11 @@ export class ProgressLine {
protected scrub(e: SUPEREVENT) { protected scrub(e: SUPEREVENT) {
let offsetX: number; let offsetX: number;
if(e instanceof TouchEvent) { if(e instanceof MouseEvent) {
offsetX = e.offsetX;
} else { // touch
const rect = (e.target as HTMLElement).getBoundingClientRect(); const rect = (e.target as HTMLElement).getBoundingClientRect();
offsetX = e.targetTouches[0].pageX - rect.left; offsetX = e.targetTouches[0].pageX - rect.left;
} else {
offsetX = e.offsetX;
} }
const scrubTime = offsetX / this.container.offsetWidth * this.duration; const scrubTime = offsetX / this.container.offsetWidth * this.duration;