From f5910407ba57815118425cdac58c9af08fc81cce Mon Sep 17 00:00:00 2001 From: Ajay Date: Fri, 18 Oct 2024 04:27:23 -0400 Subject: Simple implementation to fix seekbar rendering on gradiant layout Fixes #2099 --- src/js-components/previewBar.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3