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

@@ -1,5 +1,8 @@
// video-preview-utils.js
// Import centralized font management
import { getFontStyle } from '@/modules/editor/fonts';
// Snap settings
export const POSITION_SNAP_THRESHOLD = 10; // Pixels within which to snap to center
@@ -16,21 +19,8 @@ export const getImageSource = (element, videoStates, isPlaying) => {
return null;
};
// Helper function to get font style for text elements
export const getTextFontStyle = (element) => {
const isBold = element.fontWeight === 'bold' || element.fontWeight === 700;
const isItalic = element.fontStyle === 'italic';
if (isBold && isItalic) {
return 'bold italic';
} else if (isBold) {
return 'bold';
} else if (isItalic) {
return 'italic';
} else {
return 'normal';
}
};
// Re-export the centralized font style function for backward compatibility
export { getFontStyle as getTextFontStyle };
// Check if element uses center-offset positioning
export const usesCenterPositioning = (elementType) => {