From 0e3a6e970590be375d3826917f15a8b0fbe4007e Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 20 Feb 2024 22:27:00 +0000 Subject: [PATCH] fix: insertion marker drag scaling (#7874) * fix: insertion marker drag scaling * chore: added docs for other params --- core/block_dragger.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/core/block_dragger.ts b/core/block_dragger.ts index 26d265183..e8607d44d 100644 --- a/core/block_dragger.ts +++ b/core/block_dragger.ts @@ -204,6 +204,11 @@ export class BlockDragger implements IBlockDragger { this.updateConnectionPreview(block, delta); } + /** + * @param draggingBlock The block being dragged. + * @param dragDelta How far the pointer has moved from the position + * at the start of the drag, in pixel units. + */ private moveBlock(draggingBlock: BlockSvg, dragDelta: Coordinate) { const delta = this.pixelsToWorkspaceUnits_(dragDelta); const newLoc = Coordinate.sum(this.startXY_, delta); @@ -223,6 +228,11 @@ export class BlockDragger implements IBlockDragger { /** * Returns true if we would delete the block if it was dropped at this time, * false otherwise. + * + * @param e The most recent move event. + * @param draggingBlock The block being dragged. + * @param delta How far the pointer has moved from the position + * at the start of the drag, in pixel units. */ private wouldDeleteBlock( e: PointerEvent, @@ -245,7 +255,16 @@ export class BlockDragger implements IBlockDragger { ); } - private updateConnectionPreview(draggingBlock: BlockSvg, delta: Coordinate) { + /** + * @param draggingBlock The block being dragged. + * @param dragDelta How far the pointer has moved from the position + * at the start of the drag, in pixel units. + */ + private updateConnectionPreview( + draggingBlock: BlockSvg, + dragDelta: Coordinate, + ) { + const delta = this.pixelsToWorkspaceUnits_(dragDelta); const currCandidate = this.connectionCandidate; const newCandidate = this.getConnectionCandidate(draggingBlock, delta); if (!newCandidate) {