fix text location
This commit is contained in:
@@ -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,
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user