mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
* chore(dragging): Rename core/interfaces/i_draggable.ts Rename core/interfaces/i_draggable.ts to core/interfaces/i_draggable.old.ts to make room for new IDraggable. Do not rename actual interface as it's not yet clear that it will be necessary for both to coexist as imports in the same file. * feat(dragging): Introduce new IDraggable interface * feat(dragging): Introduce new IDragger interface --------- Co-authored-by: Beka Westberg <bwestberg@google.com>
36 lines
922 B
TypeScript
36 lines
922 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2024 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import {Coordinate} from '../utils/coordinate';
|
|
|
|
export interface IDragger {
|
|
/**
|
|
* Handles any drag startup.
|
|
*
|
|
* @param e PointerEvent that started the drag.
|
|
*/
|
|
onDragStart(e: PointerEvent): void;
|
|
|
|
/**
|
|
* Handles dragging, including calculating where the element should
|
|
* actually be moved to.
|
|
*
|
|
* @param e PointerEvent that continued the drag.
|
|
* @param totalDelta The total distance, in pixels, that the mouse
|
|
* has moved since the start of the drag.
|
|
*/
|
|
onDrag(e: PointerEvent, totalDelta: Coordinate): void;
|
|
|
|
/**
|
|
* Handles any drag cleanup.
|
|
*
|
|
* @param e PointerEvent that finished the drag.
|
|
* @param totalDelta The total distance, in pixels, that the mouse
|
|
* has moved since the start of the drag.
|
|
*/
|
|
onDragEnd(e: PointerEvent, totalDelta: Coordinate): void;
|
|
}
|