mirror of
https://github.com/google/blockly.git
synced 2026-01-11 02:47:09 +01:00
feat: add shouldHealStack method (#8872)
* feat: add shouldHealStack method * chore: format
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user