Adjust VN mode width overlap calculations

This commit is contained in:
Cohee
2023-06-04 15:33:28 +03:00
parent c33812d448
commit a273fcb593
2 changed files with 5 additions and 2 deletions

View File

@ -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
}