Skip to content

Commit

Permalink
fix: 放入自由节点之后,父容器无法再添加组件且报错
Browse files Browse the repository at this point in the history
  • Loading branch information
yanwii committed Nov 13, 2023
1 parent d64c7d5 commit 470983c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/designer/src/designer/dragon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -636,4 +642,4 @@ export class Dragon implements IDragon {
this.emitter.removeListener('dragend', func);
};
}
}
}

0 comments on commit 470983c

Please sign in to comment.