feat: add shouldHealStack method (#8872)

* feat: add shouldHealStack method

* chore: format
This commit is contained in:
Rachel Fenichel
2025-04-07 12:44:40 -07:00
committed by GitHub
parent 17171abf1c
commit 49387ec788

View File

@@ -113,7 +113,7 @@ export class BlockDragStrategy implements IDragStrategy {
this.workspace.setResizesEnabled(false);
blockAnimation.disconnectUiStop();
const healStack = !!e && (e.altKey || e.ctrlKey || e.metaKey);
const healStack = this.shouldHealStack(e);
if (this.shouldDisconnect(healStack)) {
this.disconnectBlock(healStack);
@@ -122,6 +122,17 @@ export class BlockDragStrategy implements IDragStrategy {
this.workspace.getLayerManager()?.moveToDragLayer(this.block);
}
/**
* Get whether the drag should act on a single block or a block stack.
*
* @param e The instigating pointer event, if any.
* @returns True if just the initial block should be dragged out, false
* if all following blocks should also be dragged.
*/
protected shouldHealStack(e: PointerEvent | undefined) {
return !!e && (e.altKey || e.ctrlKey || e.metaKey);
}
/** Starts a drag on a shadow, recording the drag offset. */
private startDraggingShadow(e?: PointerEvent) {
const parent = this.block.getParent();