From 470983cbec61efac06a2a01e7b174e2251611e96 Mon Sep 17 00:00:00 2001 From: "ken.yan" Date: Mon, 13 Nov 2023 16:09:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=BE=E5=85=A5=E8=87=AA=E7=94=B1?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E4=B9=8B=E5=90=8E=EF=BC=8C=E7=88=B6=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E6=97=A0=E6=B3=95=E5=86=8D=E6=B7=BB=E5=8A=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=B8=94=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/designer/src/designer/dragon.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/designer/src/designer/dragon.ts b/packages/designer/src/designer/dragon.ts index 8dcce2b4a..6e37c8a7a 100644 --- a/packages/designer/src/designer/dragon.ts +++ b/packages/designer/src/designer/dragon.ts @@ -247,9 +247,11 @@ export class Dragon implements IDragon { const sensor = chooseSensor(locateEvent); /* istanbul ignore next */ - if (isRGL) { + // have to distinguish between the fixed point and the new component + const nodes = dragObject?.nodes || []; + if (isRGL && nodes.length > 0) { // 禁止被拖拽元素的阻断 - const nodeInst = dragObject.nodes[0].getDOMNode(); + const nodeInst = dragObject?.nodes?.[0]?.getDOMNode(); if (nodeInst && nodeInst.style) { this.nodeInstPointerEvents = true; nodeInst.style.pointerEvents = 'none'; @@ -267,7 +269,7 @@ export class Dragon implements IDragon { this.emitter.emit('rgl.add.placeholder', { rglNode, fromRglNode, - node: locateEvent.dragObject?.nodes[0], + node: locateEvent.dragObject?.nodes?.[0], event: e, }); designer.clearLocation(); @@ -276,6 +278,10 @@ export class Dragon implements IDragon { return; } } else { + // reset the flag when leave rgl + if (fromRglNode) { + fromRglNode.isRGLContainerNode = false; + } this._canDrop = false; this.emitter.emit('rgl.remove.placeholder'); this.emitter.emit('rgl.sleeping', true); @@ -636,4 +642,4 @@ export class Dragon implements IDragon { this.emitter.removeListener('dragend', func); }; } -} +} \ No newline at end of file