fix(canvas-core): to avoid triggering drag container and it's children at the same time with a single event

This commit is contained in:
liuyangxing 2025-03-17 19:56:57 +08:00
parent 561c7c620c
commit 4fd6ac19ea

View File

@ -126,10 +126,12 @@ export class WorkflowDragService {
if ( if (
selectedNodes.length === 0 || selectedNodes.length === 0 ||
this.playgroundConfig.readonly || this.playgroundConfig.readonly ||
this.playgroundConfig.disabled this.playgroundConfig.disabled ||
this.isDragging
) { ) {
return Promise.resolve(false); return Promise.resolve(false);
} }
this.isDragging = true;
const sameParent = this.childrenOfContainer(selectedNodes); const sameParent = this.childrenOfContainer(selectedNodes);
if (sameParent && sameParent.flowNodeType !== FlowNodeBaseType.ROOT) { if (sameParent && sameParent.flowNodeType !== FlowNodeBaseType.ROOT) {
selectedNodes = [sameParent]; selectedNodes = [sameParent];
@ -146,7 +148,6 @@ export class WorkflowDragService {
const startTime = Date.now(); const startTime = Date.now();
const dragger = new PlaygroundDrag({ const dragger = new PlaygroundDrag({
onDragStart: (dragEvent) => { onDragStart: (dragEvent) => {
this.isDragging = true;
this._nodesDragEmitter.fire({ this._nodesDragEmitter.fire({
type: 'onDragStart', type: 'onDragStart',
nodes: selectedNodes, nodes: selectedNodes,