aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/js-components/previewBar.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts
index 6dcd835a..e3fdf745 100644
--- a/src/js-components/previewBar.ts
+++ b/src/js-components/previewBar.ts
@@ -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) {