Files
blockly/core/interfaces/i_dragger.ts
Christopher Allen 11c219c537 feat(dragging): Create (new) IDragger and IDraggable interfaces (#7953)
* 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>
2024-03-22 16:21:14 +00:00

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;
}