Stay organized with collections
Save and categorize content based on your preferences.
blockly > IDragTarget
IDragTarget interface
Interface for a component with custom behaviour when a block or bubble is dragged over or dropped on top of it.
Signature:
export interface IDragTarget extends IComponent
Extends: IComponent
Methods
Method |
Description |
getClientRect() |
Returns the bounding rectangle of the drag target area in pixel units relative to viewport. |
onDragEnter(dragElement) |
Handles when a cursor with a block or bubble enters this drag target. |
onDragExit(dragElement) |
Handles when a cursor with a block or bubble exits this drag target. |
onDragOver(dragElement) |
Handles when a cursor with a block or bubble is dragged over this drag target. |
onDrop(dragElement) |
Handles when a block or bubble is dropped on this component. Should not handle delete here. |
shouldPreventMove(dragElement) |
Returns whether the provided block or bubble should not be moved after being dropped on this component. If true, the element will return to where it was when the drag started. |
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 2024-09-18 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 2024-09-18 UTC."],[[["The `IDragTarget` interface defines how components interact with drag-and-drop operations involving blocks or bubbles in Blockly."],["It provides methods to handle events like drag enter, exit, over, and drop, as well as to define the drag target area and prevent unwanted moves."],["Developers can implement this interface to create custom components with specific drag-and-drop behaviors in Blockly workspaces."]]],[]]