commit 8cf7c07a75c3cb86cc79b4d353b19788599ca0ff
parent 191e1d1a0b13d105050cd71f5b93249877700bfa
Author: Hunter
Date: Mon, 2 Feb 2026 21:57:32 -0500
center front and back covers
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/resources/page-flip-animation.js b/resources/page-flip-animation.js
@@ -77,11 +77,12 @@ function updateBookPosition(spreadIndex, animated = true) {
// Spread 0 (front cover): single right page, shift left to center
// Spread 4 (back cover): single left page, shift right to center
+ // Half page width = 1.375in
let shiftAmount = '0in';
if (spreadIndex === 0) {
- shiftAmount = '-1.375in'; // Shift left by half a page width
+ shiftAmount = '-1.375in';
} else if (spreadIndex === 4) {
- shiftAmount = '1.375in'; // Shift right by half a page width
+ shiftAmount = '1.375in';
}
if (animated) {
@@ -95,7 +96,7 @@ function updateBookPosition(spreadIndex, animated = true) {
const scaleMatch = currentTransform.match(/scale\([^)]+\)/);
const scale = scaleMatch ? scaleMatch[0] : '';
- bookContainer.style.transform = scale ? `translateX(${shiftAmount}) ${scale}` : `translateX(${shiftAmount})`;
+ bookContainer.style.transform = scale ? `${scale} translateX(${shiftAmount})` : `translateX(${shiftAmount})`;
// Remove transition after animation completes
if (animated) {
diff --git a/resources/spread-layout.js b/resources/spread-layout.js
@@ -78,5 +78,5 @@ export function scaleSpreadToFit(container, doc, bottomPadding = 0) {
const translateMatch = currentTransform.match(/translateX\([^)]+\)/);
const translateX = translateMatch ? translateMatch[0] : '';
- bookContainer.style.transform = translateX ? `${translateX} scale(${scale})` : `scale(${scale})`;
+ bookContainer.style.transform = translateX ? `scale(${scale}) ${translateX}` : `scale(${scale})`;
}