From 46e0e2378588d980eb2ed9b52d35c884f7cf9998 Mon Sep 17 00:00:00 2001 From: parisma Date: Mon, 8 Aug 2022 19:30:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20=E4=BF=AE=E5=A4=8D=E5=85=88?= =?UTF-8?q?=E5=8D=95=E5=87=BB=E9=80=89=E4=B8=AD=E9=A1=B5=E9=9D=A2,?= =?UTF-8?q?=E5=86=8D=E8=BF=9B=E8=A1=8C=E5=A4=9A=E9=80=89=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/stage/src/StageCore.ts | 2 +- packages/stage/src/StageMultiDragResize.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) 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);