chore: 优化容器高度拖拽判断

This commit is contained in:
zhangtao07 2024-04-01 20:27:52 +08:00
parent a8f46047c8
commit b62ab81591
3 changed files with 7 additions and 11 deletions

View File

@ -24,6 +24,6 @@
&-itemColumn {
height: 100%;
background-color: #999;
background-color: #ccc;
}
}

View File

@ -142,10 +142,10 @@ export class ContainerPlugin extends LayoutBasePlugin {
const node = context.node!;
const isFlexItem = this.manager?.isFlexItem(node.id);
if (isFlexItem) {
let isColumnFlex = String(
node.parent?.schema?.style?.flexDirection
).includes('column');
context?.node.setHeightMutable(false);
let isColumnFlex = this.manager.isFlexColumnItem(node.id);
context?.node.setHeightMutable(
node?.schema?.isFixedHeight && !isColumnFlex
);
context?.node.setWidthMutable(
(!isColumnFlex && context.node.parent?.children?.length > 1) ||
node.schema?.style?.flex === '0 0 150px'
@ -178,9 +178,7 @@ export class ContainerPlugin extends LayoutBasePlugin {
const frameRect = parent.getBoundingClientRect();
const rect = dom.getBoundingClientRect();
const isFlexItem = this.manager?.isFlexItem(node.id);
const isColumnFlex = String(host?.schema?.style?.flexDirection).includes(
'column'
);
const isColumnFlex = this.manager?.isFlexColumnItem(node.id);
const schema = node.schema;
const index = node.index;
const isFlexSize =

View File

@ -109,9 +109,7 @@ export class FlexPluginBase extends LayoutBasePlugin {
if (/^[\d:]+$/.test(value) && isAlive(node)) {
let list = value.trim().split(':');
let children = node.children || [];
const isColumn = String(node.schema?.style?.flexDirection).includes(
'column'
);
const isColumn = this.manager?.isFlexColumnItem(node.id);
// 更新flex布局
for (let i = 0; i < children.length; i++) {