center front and back covers
Hunter
Monday, February 2nd, 2026 at 9:57 PM
77
78 // Spread 0 (front cover): single right page, shift left to center
79 // Spread 4 (back cover): single left page, shift right to center
80 + // Half page width = 1.375in
81 let shiftAmount = '0in';
82 if (spreadIndex === 0) {
- shiftAmount = '-1.375in'; // Shift left by half a page width
83 + shiftAmount = '-1.375in';
84 } else if (spreadIndex === 4) {
- shiftAmount = '1.375in'; // Shift right by half a page width
85 + shiftAmount = '1.375in';
86 }
87
88 if (animated) {
96 const scaleMatch = currentTransform.match(/scale\([^)]+\)/);
97 const scale = scaleMatch ? scaleMatch[0] : '';
98
- bookContainer.style.transform = scale ? `translateX(${shiftAmount}) ${scale}` : `translateX(${shiftAmount})`;
99 + bookContainer.style.transform = scale ? `${scale} translateX(${shiftAmount})` : `translateX(${shiftAmount})`;
100
101 // Remove transition after animation completes
102 if (animated) {
78 const translateMatch = currentTransform.match(/translateX\([^)]+\)/);
79 const translateX = translateMatch ? translateMatch[0] : '';
80
- bookContainer.style.transform = translateX ? `${translateX} scale(${scale})` : `scale(${scale})`;
81 + bookContainer.style.transform = translateX ? `scale(${scale}) ${translateX}` : `scale(${scale})`;
82 }