Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace CellDragUtils

Index

Type aliases

ICellTargetArea

ICellTargetArea: "input" | "prompt" | "cell" | "unknown"

Functions

createCellDragImage

  • createCellDragImage(activeCell: Cell, selectedCells: nbformat.ICell[]): HTMLElement
  • Create an image for the cell(s) to be dragged

    Parameters

    • activeCell: Cell

      The cell from where the drag event is triggered

    • selectedCells: nbformat.ICell[]

      The cells to be dragged

    Returns HTMLElement

detectTargetArea

  • Detect which part of the cell triggered the MouseEvent

    Parameters

    • cell: Cell

      The cell which contains the MouseEvent's target

    • target: HTMLElement

      The DOM node which triggered the MouseEvent

    Returns ICellTargetArea

findCell

  • findCell(node: HTMLElement, cells: IterableOrArrayLike<Cell>, isCellNode: (node: HTMLElement) => boolean): number
  • Find the cell index containing the target html element. This function traces up the DOM hierarchy to find the root cell node. Then find the corresponding child and select it.

    Parameters

    • node: HTMLElement

      the cell node or a child of the cell node.

    • cells: IterableOrArrayLike<Cell>

      an iterable of Cells

    • isCellNode: (node: HTMLElement) => boolean

      a function that takes in a node and checks if it is a cell node.

        • (node: HTMLElement): boolean
        • Parameters

          • node: HTMLElement

          Returns boolean

    Returns number

    index of the cell we're looking for. Returns -1 if the cell is not founds

shouldStartDrag

  • shouldStartDrag(prevX: number, prevY: number, nextX: number, nextY: number): boolean
  • Detect if a drag event should be started. This is down if the mouse is moved beyond a certain distance (DRAG_THRESHOLD).

    Parameters

    • prevX: number

      X Coordinate of the mouse pointer during the mousedown event

    • prevY: number

      Y Coordinate of the mouse pointer during the mousedown event

    • nextX: number

      Current X Coordinate of the mouse pointer

    • nextY: number

      Current Y Coordinate of the mouse pointer

    Returns boolean

Generated using TypeDoc