diff --git a/public/scripts/extensions/expressions/index.js b/public/scripts/extensions/expressions/index.js index 5786b693b..9be0bbd12 100644 --- a/public/scripts/extensions/expressions/index.js +++ b/public/scripts/extensions/expressions/index.js @@ -192,8 +192,10 @@ async function visualNovelUpdateLayers(container) { let currentPosition = pivotalPoint - (totalWidth / 2); if (totalWidth > containerWidth) { - let overlap = (totalWidth - containerWidth) / (imagesWidth.length - 1); - imagesWidth = imagesWidth.map((width) => width - overlap); + let totalOverlap = totalWidth - containerWidth; + let totalWidthWithoutWidest = imagesWidth.reduce((a, b) => a + b, 0) - Math.max(...imagesWidth); + let overlaps = imagesWidth.map(width => (width / totalWidthWithoutWidest) * totalOverlap); + imagesWidth = imagesWidth.map((width, index) => width - overlaps[index]); currentPosition = 0; // Reset the initial position to 0 } diff --git a/public/scripts/extensions/expressions/style.css b/public/scripts/extensions/expressions/style.css index e29b1f20f..51b330f21 100644 --- a/public/scripts/extensions/expressions/style.css +++ b/public/scripts/extensions/expressions/style.css @@ -15,6 +15,7 @@ height: calc(100vh - 40px); width: 100vw; position: relative; + overflow: hidden; } #visual-novel-wrapper .expression-holder {