aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2024-10-18 04:27:23 -0400
committerAjay <[email protected]>2024-10-18 04:27:23 -0400
commitf5910407ba57815118425cdac58c9af08fc81cce (patch)
tree17eaaab3ba4aa215223bc2a24df93e852d5ef552
parent2691dc5df5d503259a98e3e29bc69b0883561ab0 (diff)
downloadSponsorBlock-f5910407ba57815118425cdac58c9af08fc81cce.tar.gz
SponsorBlock-f5910407ba57815118425cdac58c9af08fc81cce.zip
Simple implementation to fix seekbar rendering on gradiant layout
Fixes #2099
-rw-r--r--src/js-components/previewBar.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts
index 004d4677..6dcd835a 100644
--- a/src/js-components/previewBar.ts
+++ b/src/js-components/previewBar.ts
@@ -647,8 +647,16 @@ class PreviewBar {
if (changedData.scale !== null) {
const transformScale = (changedData.scale) / progressBar.clientWidth;
+ const scale = Math.max(0, Math.min(1 - calculatedLeft, (transformScale - cursor) / fullSectionWidth - calculatedLeft));
customChangedElement.style.transform =
- `scaleX(${Math.max(0, Math.min(1 - calculatedLeft, (transformScale - cursor) / fullSectionWidth - calculatedLeft))}`;
+ `scaleX(${scale})`;
+ if (customChangedElement.style.backgroundSize) {
+ const backgroundSize = progressBar.clientWidth;
+ customChangedElement.style.backgroundSize = `${backgroundSize}px`;
+
+ customChangedElement.style.backgroundPosition = `${-(cursor * progressBar.clientWidth)}px`;
+ }
+
if (firstUpdate) {
customChangedElement.style.transition = "none";
setTimeout(() => customChangedElement.style.removeProperty("transition"), 50);