From 8860d407dcb0b550a19b0c260227242f9444044c Mon Sep 17 00:00:00 2001 From: _Kerman Date: Fri, 10 Nov 2023 18:02:09 +0800 Subject: [PATCH] upd: prevent docking to block which is predicting --- packages/visual-flow/src/model/block.ts | 1 + packages/visual-flow/src/model/graph.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/visual-flow/src/model/block.ts b/packages/visual-flow/src/model/block.ts index ef39b59..a542e5d 100644 --- a/packages/visual-flow/src/model/block.ts +++ b/packages/visual-flow/src/model/block.ts @@ -319,6 +319,7 @@ export abstract class Block extends ModelBase { } isDockableBy(block: Block): null | [number, Direction, Point] { + if (this === block || this.predicting) return null; let minDockingDistanceSquare = MIN_DOCKING_DISTANCE_SQUARE; let dockingInfo: [Direction, Point] | null = null; for (const direction of this.dockableDirections) { diff --git a/packages/visual-flow/src/model/graph.ts b/packages/visual-flow/src/model/graph.ts index 0d0d4a5..9f499c6 100644 --- a/packages/visual-flow/src/model/graph.ts +++ b/packages/visual-flow/src/model/graph.ts @@ -517,7 +517,6 @@ export class Graph { for (let i = this.blockZIndex.length - 1; i >= 0; i--) { const target = this.blockZIndex[i]; if (!target) continue; - if (target === block) continue; const result = target.isDockableBy(block); if (result !== null) { const [distanceSquare, ...dockingInfo] = result;