diff --git a/packages/stage/src/StageCore.ts b/packages/stage/src/StageCore.ts index 30a773b7..b70f6155 100644 --- a/packages/stage/src/StageCore.ts +++ b/packages/stage/src/StageCore.ts @@ -180,7 +180,7 @@ export default class StageCore extends EventEmitter { if (!canSelectByProp) return false; // 多选规则 if (this.mask.isMultiSelectStatus) { - return this.multiDr.canSelect(el); + return this.multiDr.canSelect(el, stop); } return true; } diff --git a/packages/stage/src/StageMultiDragResize.ts b/packages/stage/src/StageMultiDragResize.ts index d8cfe66e..dd27e6d9 100644 --- a/packages/stage/src/StageMultiDragResize.ts +++ b/packages/stage/src/StageMultiDragResize.ts @@ -127,16 +127,20 @@ export default class StageMultiDragResize extends EventEmitter { }); } - public canSelect(el: HTMLElement): Boolean { - // 多选不可以选中magic-ui-page + public canSelect(el: HTMLElement, stop: () => boolean): Boolean { + // 多选状态下不可以选中magic-ui-page,并停止继续向上层选中 if (el.className.includes(PAGE_CLASS)) { this.core.highlightedDom = undefined; this.core.highlightLayer.clearHighlight(); + stop(); return false; } const currentTargetMode = getMode(el); let selectedDomMode = ''; - + if (this.core.selectedDom?.className.includes(PAGE_CLASS)) { + // 先单击选中了页面(magic-ui-page),再按住多选键多选时,任一元素均可选中 + return true; + } if (this.targetList.length === 0 && this.core.selectedDom) { // 单选后添加到多选的情况 selectedDomMode = getMode(this.core.selectedDom);