Skip to content

Commit

Permalink
Simple implementation to fix seekbar rendering on gradiant layout
Browse files Browse the repository at this point in the history
Fixes #2099
  • Loading branch information
ajayyy committed Oct 18, 2024
1 parent 2691dc5 commit f591040
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/js-components/previewBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f591040

Please sign in to comment.