From 3fdd4dedf434a45ded0c7114cf1cd0c8a1e94a18 Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Tue, 23 Apr 2024 21:24:33 +0800 Subject: [PATCH] fix: list position error when setting row flex #523 --- src/editor/core/position/Position.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/editor/core/position/Position.ts b/src/editor/core/position/Position.ts index b65a80a..c193732 100644 --- a/src/editor/core/position/Position.ts +++ b/src/editor/core/position/Position.ts @@ -121,10 +121,11 @@ export class Position { for (let i = 0; i < rowList.length; i++) { const curRow = rowList[i] // 计算行偏移量(行居中、居右) + const curRowWidth = curRow.width + (curRow.offsetX || 0) if (curRow.rowFlex === RowFlex.CENTER) { - x += (innerWidth - curRow.width) / 2 + x += (innerWidth - curRowWidth) / 2 } else if (curRow.rowFlex === RowFlex.RIGHT) { - x += innerWidth - curRow.width + x += innerWidth - curRowWidth } // 当前行X轴偏移量 x += curRow.offsetX || 0