Skip to content

Commit 951eb42

Browse files
chore: cleanup
1 parent 8945992 commit 951eb42

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/keyboard_drag_strategy.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ interface ConnectionCandidate {
2222

2323
// @ts-expect-error overrides a private function.
2424
export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
25+
/** Which direction the current constrained drag is in, if any. */
2526
private currentDragDirection: Direction | null = null;
27+
28+
/** Where a constrained movement should start when traversing the tree. */
2629
private searchNode: ASTNode | null = null;
2730

2831
override startDrag(e?: PointerEvent) {
@@ -55,14 +58,15 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
5558
/**
5659
* Returns the next compatible connection in keyboard navigation order,
5760
* based on the input direction.
58-
* Always resumes the search at the last
61+
* Always resumes the search at the last valid connection that was tried.
5962
*
6063
* @param draggingBlock The block where the drag started.
6164
* @returns A valid connection candidate, or null if none was found.
6265
*/
6366
private getConstrainedConnectionCandidate(
6467
draggingBlock: BlockSvg,
6568
): ConnectionCandidate | null {
69+
// TODO(#385): Make sure this works for any cursor, not just LineCursor.
6670
const cursor = draggingBlock.workspace.getCursor() as LineCursor;
6771

6872
const initialNode = this.searchNode;
@@ -97,7 +101,9 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
97101
localConns.forEach((conn: RenderedConnection) => {
98102
const potentialLocation =
99103
potential?.getLocation() as RenderedConnection;
100-
if (connectionChecker.canConnect(conn, potentialLocation, true, 5000)) {
104+
if (
105+
connectionChecker.canConnect(conn, potentialLocation, true, Infinity)
106+
) {
101107
candidateConnection = {
102108
local: conn,
103109
neighbour: potentialLocation,

0 commit comments

Comments
 (0)