fix(editor): 添加组件默认添加到视窗中间,如果组件初始化height不是数值,则当0处理
This commit is contained in:
@@ -142,9 +142,13 @@ export const toRelative = (node: MNode) => {
|
||||
|
||||
const setTop2Middle = (node: MNode, parentNode: MNode, stage: StageCore) => {
|
||||
const style = node.style || {};
|
||||
const height = style.height || 0;
|
||||
let height = style.height || 0;
|
||||
|
||||
if (!stage || typeof style.top !== 'undefined' || !parentNode.style || !isNumber(height)) return style;
|
||||
if (!stage || typeof style.top !== 'undefined' || !parentNode.style) return style;
|
||||
|
||||
if (!isNumber(height)) {
|
||||
height = 0;
|
||||
}
|
||||
|
||||
const { height: parentHeight } = parentNode.style;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user