@maxgraph/core
    Preparing search index...

    Class SelectionHandler

    Graph event handler that handles selection.

    Individual cells are handled separately by SelectionCellsHandler using VertexHandler or one of the EdgeHandlers. When the SelectionCellsHandler plugin is registered in the AbstractGraph, SelectionHandler interacts with this plugin to propagate global selection events to individual cells.

    To avoid the container to scroll a moved cell into view, set scrollOnMove to false.

    Implements

    Index
    allCells: Map<Cell, CellState> = ...
    allowLivePreview: boolean = Client.IS_SVG

    If live preview is allowed on this system.

    true for systems with SVG support.
    
    bounds: Rectangle | null = null
    cell: Cell | null = null
    cellCount: number = 0
    cells: Cell[] | null = null
    cellWasClicked: boolean = false
    cloneEnabled: boolean = true

    Specifies if cloning by control-drag is enabled.

    true
    
    cloning: boolean = false
    connectOnDrop: boolean = false

    Specifies if drop events are interpreted as new connections if no other drop action is defined.

    false
    
    currentDx: number = 0

    Stores the x-coordinate of the current mouse move.

    currentDy: number = 0

    Stores the y-coordinate of the current mouse move.

    delayedSelection: boolean = false
    enabled: boolean = true

    Specifies if events are handled.

    true
    
    escapeHandler: (sender: EventSource, evt: EventObject) => void
    first: Point | null = null

    Reference to the enclosing AbstractGraph.

    guide: Guide | null = null

    Holds the Guide instance that is used for alignment.

    guidesEnabled: boolean = false

    Specifies if other cells should be used for snapping the right, center or left side of the current selection.

    false
    
    handlesVisible: boolean = true

    Whether the handles of the selection are currently visible.

    true
    
    highlight: CellHighlight | null = null
    highlightEnabled: boolean = true

    Specifies if drop targets under the mouse should be enabled.

    true
    
    htmlPreview: boolean = false

    Specifies if the graph container should be used for preview. If this is used then drop target detection relies entirely on AbstractGraph.getCellAt because the HTML preview does not "let events through".

    false
    
    keyHandler: (e: KeyboardEvent) => void
    livePreviewActive: boolean = false
    livePreviewUsed: boolean = false
    maxCells: number = 50

    Defines the maximum number of cells to paint sub-handles for.

    Set this to 0 if you want an unlimited number of handles to be displayed. This is only recommended if the number of cells in the graph is limited to a small number, e.g. 500.

    50
    
    maxLivePreview: number = 0

    Maximum number of cells for which live preview should be used.

    0 means no live preview.

    0
    
    minimumSize: number = 6

    Specifies the minimum number of pixels for the width and height of a selection border.

    6
    
    moveEnabled: boolean = true

    Specifies if moving is enabled.

    true
    
    panHandler: () => void
    pBounds: Rectangle | null = null
    previewColor: string = 'black'

    Specifies the color of the preview shape.

    black
    
    refreshHandler: (sender: EventSource, evt: EventObject) => void
    refreshThread: number | null = null
    removeCellsFromParent: boolean = true

    Specifies if cells may be moved out of their parents.

    true
    
    removeEmptyParents: boolean = false

    If empty parents should be removed from the model after all child cells have been moved out.

    false
    
    rotationEnabled: boolean = true

    Specifies if the bounding box should allow for rotation.

    true
    
    scaleGrid: boolean = false

    Specifies if the grid should be scaled.

    false
    
    scrollOnMove: boolean = true

    Specifies if the view should be scrolled so that a moved cell is visible.

    true
    
    selectEnabled: boolean = true

    Specifies if selecting is enabled.

    true
    
    shape: Shape | null = null

    Reference to the Shape that represents the preview.

    suspended: boolean = false
    target: Cell | null = null
    updateCursor: boolean = true

    Specifies if a move cursor should be shown if the mouse is over a movable cell.

    true
    
    pluginId: "SelectionHandler" = 'SelectionHandler'
    • Consumes the given mouse event.

      NOTE: This may be used to enable click events for links in labels on iOS as follows as consuming the initial touchStart disables firing the subsequent click event on the link.

      consumeMouseEvent(evtName, me) {
      const source = eventUtils.getSource(me.getEvent());

      if (!eventUtils.isTouchEvent(me.getEvent()) || source.nodeName != 'A') {
      me.consume();
      }
      }

      Parameters

      Returns void

    • Returns the cells to be modified by this handler.

      This implementation returns all selection cells that are movable, or the given initial cell if the given cell is not selected and movable. This handles the case of moving unselectable or unselected cells.

      Parameters

      • initialCell: Cell

        Cell that triggered this handler.

      Returns Cell[]

    • Moves the given cells by the specified amount.

      Parameters

      • cells: Cell[]
      • dx: number
      • dy: number
      • clone: boolean
      • target: Cell | null
      • evt: MouseEvent

      Returns void

    • Hook for rounding the unscaled vector. This uses Math.round and keep only 2 digits.

      Parameters

      • length: number

      Returns number

    • Sets whether the handles attached to the given cells are visible.

      Parameters

      • cells: Cell[]

        Array of Cells.

      • visible: boolean

        Boolean that specifies if the handles should be visible.

      • force: boolean = false

        Forces an update of the handler regardless of the last used value.

      Returns void

    • Sets the color of the rectangle used to highlight drop targets.

      Parameters

      • color: string

        String that represents the new highlight color.

      Returns void

    • Returns true if the given cells should be removed from the parent for the specified "mouse released" event.

      Parameters

      • parent: Cell
      • cells: Cell[]
      • evt: MouseEvent

      Returns boolean

    • Updates the bounds of the preview shape.

      Parameters

      • dx: number
      • dy: number

      Returns void