Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 放入自由节点之后,父容器无法再添加组件且报错 #2642

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
};
}
}
}
Loading