fix text location

This commit is contained in:
hamid zarghami
2026-05-06 15:06:55 +03:30
parent 8717afbced
commit ae7eae34d9
2 changed files with 12 additions and 1 deletions
+8 -1
View File
@@ -74,17 +74,24 @@ const BookPage = forwardRef<HTMLDivElement, BookPageProps>(
// برای text، opacity در رنگ اعمال می‌شود، پس باید opacity را از baseStyle حذف کنیم
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { opacity, ...textBaseStyle } = baseStyle;
const textWidth = obj.width ? obj.width * scale : undefined;
const textLeft = ((obj.x || 0) - (obj.width || 0)) * scale;
return (
<div
key={obj.id || index}
style={{
...textBaseStyle,
left: `${textLeft}px`,
width: textWidth ? `${textWidth}px` : undefined,
fontSize: `${(obj.fontSize || 16) * scale}px`,
fontFamily: obj.fontFamily || 'irancell, sans-serif',
fontWeight: obj.fontWeight || 'normal',
lineHeight: 1,
lineHeight: obj.lineHeight ?? 1.2,
textAlign: obj.textAlign ?? 'right',
direction: 'rtl',
color: getColorWithOpacity(obj.fill, obj.opacity),
whiteSpace: 'pre-wrap',
wordBreak: 'break-word',
letterSpacing: obj.letterSpacing ? `${obj.letterSpacing * scale}px` : undefined,
}}
>