feat: add getSearchRadius to BlockDragStrategy (#8871)

This commit is contained in:
Rachel Fenichel
2025-04-07 13:52:15 -07:00
committed by GitHub
parent 49387ec788
commit 76b02de654

View File

@@ -326,9 +326,7 @@ export class BlockDragStrategy implements IDragStrategy {
delta: Coordinate,
): ConnectionCandidate | null {
const localConns = this.getLocalConnections(draggingBlock);
let radius = this.connectionCandidate
? config.connectingSnapRadius
: config.snapRadius;
let radius = this.getSearchRadius();
let candidate = null;
for (const conn of localConns) {
@@ -346,6 +344,15 @@ export class BlockDragStrategy implements IDragStrategy {
return candidate;
}
/**
* Get the radius to use when searching for a nearby valid connection.
*/
protected getSearchRadius() {
return this.connectionCandidate
? config.connectingSnapRadius
: config.snapRadius;
}
/**
* Returns all of the connections we might connect to blocks on the workspace.
*