fix: insertion marker drag scaling (#7874)

* fix: insertion marker drag scaling

* chore: added docs for other params
This commit is contained in:
Beka Westberg
2024-02-20 22:27:00 +00:00
committed by GitHub
parent 3073e8d444
commit 0e3a6e9705

View File

@@ -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) {