fix(editor): 恢复新增组件在当前视窗中垂直居中

fixNodePosition 不应要求 style 已存在 top 才计算居中位置,否则从组件面板新增时无法写入视窗居中 top。
This commit is contained in:
roymondchen 2026-06-17 14:20:07 +08:00
parent 95769d6ae0
commit 24b9b34f65

View File

@ -378,11 +378,11 @@ export const fixNodePosition = (config: MNode, parent: MContainer, stage: StageC
const style = { ...(config.style || {}) };
const baseStyle = config.style || {};
if ('left' in baseStyle && !('right' in baseStyle)) {
if (!('right' in baseStyle)) {
style.left = fixNodeLeft(config, parent, stage?.renderer?.contentWindow?.document);
}
if ('top' in baseStyle && !('bottom' in baseStyle)) {
if (!('top' in baseStyle) && !('bottom' in baseStyle)) {
style.top = getMiddleTop(config, parent, stage);
}