Define left + right on previewbar segments instead of left + width

This commit is contained in:
mini-bomba 2023-03-24 23:21:42 +01:00
parent 5711e70dbb
commit 0001d28f14
No known key found for this signature in database
GPG key ID: 30F8B138B4794886

View file

@ -337,13 +337,16 @@ class PreviewBar {
bar.style.position = "absolute";
const duration = Math.min(segment[1], this.videoDuration) - segment[0];
if (duration > 0) {
bar.style.width = `calc(${this.intervalToPercentage(segment[0], segment[1])}${
this.chapterFilter(barSegment) && segment[1] < this.videoDuration ? ` - ${this.chapterMargin}px` : ''})`;
}
const startTime = segment[1] ? Math.min(this.videoDuration, segment[0]) : segment[0];
const endTime = Math.min(this.videoDuration, segment[1]);
bar.style.left = this.timeToPercentage(startTime);
const time = segment[1] ? Math.min(this.videoDuration, segment[0]) : segment[0];
bar.style.left = this.timeToPercentage(time);
if (duration > 0) {
bar.style.right = this.timeToPercentage(this.videoDuration - endTime);
}
if (this.chapterFilter(barSegment) && segment[1] < this.videoDuration) {
bar.style.marginRight = `${this.chapterMargin}px`;
}
return bar;
}