mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-09-20 04:53:43 +02:00
Define left + right on previewbar segments instead of left + width
This commit is contained in:
parent
5711e70dbb
commit
0001d28f14
1 changed files with 28 additions and 25 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue