mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
feat: add getSearchRadius to BlockDragStrategy (#8871)
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user