blockly > DeleteArea
DeleteArea class
Abstract class for a component that can delete a block or bubble that is dropped on top of it.
Signature:
export declare class DeleteArea extends DragTarget implements IDeleteArea
Extends: DragTarget
Implements: IDeleteArea
Constructors
Constructor |
Modifiers |
Description |
(constructor)() |
|
Constructor for DeleteArea. Should not be called directly, only by a subclass. |
Properties
Property |
Modifiers |
Type |
Description |
id |
|
string |
The unique id for this component that is used to register with the ComponentManager. |
wouldDelete_ |
protected |
boolean |
Whether the last block or bubble dragged over this delete area would be deleted if dropped on this component. This property is not updated after the block or bubble is deleted. |
Methods
Method |
Modifiers |
Description |
updateWouldDelete_(wouldDelete) |
protected |
Updates the internal wouldDelete_ state. |
wouldDelete(element) |
|
Returns whether the provided block or bubble would be deleted if dropped on this area. This method should check if the element is deletable and is always called before onDragEnter/onDragOver/onDragExit. |
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.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `DeleteArea` class in Blockly manages the deletion of blocks or bubbles dropped onto it."],["It's an abstract class extending `DragTarget` and implementing `IDeleteArea`, meant to be subclassed."],["It uses a `wouldDelete_` property to track if a dragged element would be deleted upon release."],["The `wouldDelete` method determines if a given element is deletable when dragged over the area."],["It provides `updateWouldDelete_` to manage the internal deletion state."]]],["The `DeleteArea` class, extending `DragTarget` and implementing `IDeleteArea`, manages the deletion of blocks or bubbles. It features a constructor and properties like `id` and `wouldDelete_`, the later tracking whether a dragged element would be deleted if dropped. Key methods include `updateWouldDelete_`, which manages the `wouldDelete_` state, and `wouldDelete`, determining if a dragged element is deletable. This class does not allow being directly instantiated, only used through subclasses.\n"]]