Stay organized with collections
Save and categorize content based on your preferences.
blockly > dragging > BlockDragStrategy
dragging.BlockDragStrategy class
Signature:
export declare class BlockDragStrategy implements IDragStrategy
Implements: IDragStrategy
Constructors
Constructor |
Modifiers |
Description |
(constructor)(block) |
|
Constructs a new instance of the BlockDragStrategy class |
Methods
Method |
Modifiers |
Description |
drag(newLoc) |
|
Moves the block and updates any connection previews. |
endDrag(e) |
|
Cleans up any state at the end of the drag. Applies any pending connections. |
getSearchRadius() |
protected |
Get the radius to use when searching for a nearby valid connection. |
isMovable() |
|
Returns true if the block is currently movable. False otherwise. |
revertDrag() |
|
Moves the block back to where it was at the beginning of the drag, including reconnecting connections. |
shouldHealStack(e) |
protected |
Get whether the drag should act on a single block or a block stack. |
startDrag(e) |
|
Handles any setup for starting the drag, including disconnecting the block from any parent blocks. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["The `BlockDragStrategy` class manages the dragging behavior of blocks within Blockly."],["It provides methods for initiating, performing, and concluding drag operations, including handling connections and preview updates."],["This class ensures that block movement and interactions during dragging are handled correctly, including reverting to the original position if necessary."],["It implements the `IDragStrategy` interface, providing a consistent approach to drag-and-drop interactions within Blockly."]]],["The `BlockDragStrategy` class, implementing `IDragStrategy`, manages block dragging in Blockly. Key actions include `startDrag`, which disconnects the block from parents, and `drag`, which moves the block and updates previews. `endDrag` finalizes the drag, applying connections, while `revertDrag` returns the block to its original position. `isMovable` checks if a block is draggable. The constructor initializes a new `BlockDragStrategy` instance.\n"]]