Skip to content

Commit 1c6f2a5

Browse files
fix: position of block at the start of a drag
1 parent bac96c1 commit 1c6f2a5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/actions/clipboard.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
import {
8-
ASTNode,
98
ContextMenuRegistry,
109
Gesture,
1110
ShortcutRegistry,

src/keyboard_drag_strategy.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,12 @@
66

77
import {dragging} from 'blockly';
88

9-
export class KeyboardDragStrategy extends dragging.BlockDragStrategy {}
9+
export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
10+
override startDrag(e?: PointerEvent) {
11+
super.startDrag(e);
12+
// Set position of the dragging block, so that it doesn't pop
13+
// to the top left of the workspace.
14+
// @ts-expect-error block and startLoc are private.
15+
this.block.moveDuringDrag(this.startLoc);
16+
}
17+
}

0 commit comments

Comments
 (0)