@maxgraph/core
    Preparing search index...

    Class TooltipHandler

    Plugin that displays tooltips. It is generally enabled using AbstractGraph.setTooltips.

    getTooltip is used to get the tooltip for a cell or handle.

    IMPORTANT: Provides additional tooltip information on edges when the SelectionCellsHandler (cell selection) plugin is available. See getTooltip for more details.

    Implements

    Index

    Constructors

    Properties

    delay: number = 500

    Delay to show the tooltip in milliseconds.

    500
    
    destroyed: boolean = false

    true if this handler was destroyed using onDestroy.

    div?: null | HTMLElement
    enabled: boolean = false

    Specifies if events are handled.

    false
    

    Reference to the enclosing AbstractGraph.

    hideOnHover: boolean = false

    Specifies if the tooltip should be hidden if the mouse is moved over the current cell.

    false
    
    ignoreTouchEvents: boolean = true

    Specifies if touch and pen events should be ignored.

    true
    
    lastX: number = 0
    lastY: number = 0
    node: any
    state: null | CellState = null
    stateSource: boolean = false
    thread: null | number = null
    zIndex: number = 10005

    Specifies the zIndex for the tooltip and its shadow.

    10005
    
    pluginId: string = 'TooltipHandler'

    Methods

    • Returns the string or DOM node that represents the tooltip for the given state, node and coordinate pair.

      This implementation checks if the given node is a folding icon or overlay and returns the respective tooltip.

      • If this does not result in a tooltip, the handler for the cell is retrieved from SelectionCellsHandler and the optional getTooltipForNode method is called.
      • If no special tooltip exists here then getTooltipForCell is used with the cell in the given state as the argument to return a tooltip for the given state.

      Parameters

      • state: CellState

        CellState whose tooltip should be returned.

      • node: HTMLElement | SVGElement

        DOM node that is currently under the mouse.

      • x: number

        X-coordinate of the mouse.

      • y: number

        Y-coordinate of the mouse.

      Returns null | string | HTMLElement

      0.23.0

    • Returns the string or DOM node to be used as the tooltip for the given cell. This implementation uses the Cell.getTooltip function if it exists, or else it returns convertValueToString for the cell.

      To replace all tooltips with the string "Hello, World!", use the following code:

      const tooltipHandler = graph.getPlugin<TooltipHandler>('TooltipHandler')!;
      tooltipHandler.getTooltipForCell = function(cell) {
      return 'Hello, World!';
      }

      Parameters

      • cell: Cell

        Cell whose tooltip should be returned.

      Returns string

      0.23.0

    • Shows the tooltip for the specified cell and optional index at the specified location (with a vertical offset of 10 pixels).

      Parameters

      • tip: null | string | HTMLElement
      • x: number
      • y: number

      Returns void