This commit is contained in:
ct
2025-06-28 12:54:30 +08:00
parent f8dc4c01f2
commit fe1066583a
13 changed files with 781 additions and 175 deletions

View File

@@ -77,6 +77,21 @@ export const generateTimelineFromTemplate = (dimensions, template, mediaStoreDat
case 'caption':
if (currentCaption) {
processedElement.text = currentCaption;
// Calculate text width properties for better rendering consistency
const textWidth = Math.min(dimensions.width * 0.8, 600); // Max 80% of canvas width or 600px
processedElement.fixedWidth = textWidth;
processedElement.offsetX = textWidth / 2; // Center alignment offset
// Ensure text is positioned properly (center horizontally)
if (!processedElement.x || processedElement.x === 0) {
processedElement.x = dimensions.width / 2; // Center horizontally
}
// Ensure text has proper vertical positioning
if (!processedElement.y || processedElement.y === 0) {
processedElement.y = dimensions.height * 0.1; // 10% from top
}
} else {
return null; // Skip if no caption
}