Make gradiant display for chapter seek bar follow the same UI as YouTube

This commit is contained in:
Ajay
2024-10-18 05:05:03 -04:00
parent 510c3723ad
commit 875ec357d9

View File

@@ -651,10 +651,15 @@ class PreviewBar {
customChangedElement.style.transform =
`scaleX(${scale})`;
if (customChangedElement.style.backgroundSize) {
const backgroundSize = progressBar.clientWidth;
const backgroundSize = Math.max(changedData.scale / scale, fullSectionWidth * progressBar.clientWidth);
customChangedElement.style.backgroundSize = `${backgroundSize}px`;
customChangedElement.style.backgroundPosition = `${-(cursor * progressBar.clientWidth)}px`;
if (changedData.scale < (cursor + fullSectionWidth) * progressBar.clientWidth) {
customChangedElement.style.backgroundPosition = `-${backgroundSize - fullSectionWidth * progressBar.clientWidth}px`;
} else {
// Passed this section
customChangedElement.style.backgroundPosition = `-${cursor * progressBar.clientWidth}px`;
}
}
if (firstUpdate) {