GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • @maxgraph/core

This view

  • Original page
  • New address

GeezerVison is showing maxgraph.github.io — TooltipHandler | @maxgraph/core

  • TooltipHandler

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

  • GraphPlugin
  • MouseListenerSet
  • Defined in view/plugin/TooltipHandler.ts:46
Index

Constructors

constructor

Properties

delay destroyed div? enabled graph hideOnHover ignoreTouchEvents lastX lastY node state stateSource thread zIndex pluginId

Methods

getStateForEvent getTooltip getTooltipForCell hide hideTooltip init isEnabled isHideOnHover mouseDown mouseMove mouseUp onDestroy reset resetTimer setEnabled setHideOnHover show

Constructors

constructor

  • new TooltipHandler(graph: AbstractGraph): TooltipHandler

    Constructs an event handler that displays tooltips.

    Parameters

    • graph: AbstractGraph

      Reference to the enclosing AbstractGraph.

    Returns TooltipHandler

    • Defined in view/plugin/TooltipHandler.ts:86

Properties

delay

delay: number = 500

Delay to show the tooltip in milliseconds.

Default

500
  • Defined in view/plugin/TooltipHandler.ts:108

destroyed

destroyed: boolean = false

true if this handler was destroyed using onDestroy.

  • Defined in view/plugin/TooltipHandler.ts:125

Optionaldiv

div?: HTMLElement | null
  • Defined in view/plugin/TooltipHandler.ts:91

enabled

enabled: boolean = false

Specifies if events are handled.

Default

false
  • Defined in view/plugin/TooltipHandler.ts:138

graph

graph: AbstractGraph

Reference to the enclosing AbstractGraph.

  • Defined in view/plugin/TooltipHandler.ts:102

hideOnHover

hideOnHover: boolean = false

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

Default

false
  • Defined in view/plugin/TooltipHandler.ts:120

ignoreTouchEvents

ignoreTouchEvents: boolean = true

Specifies if touch and pen events should be ignored.

Default

true
  • Defined in view/plugin/TooltipHandler.ts:114

lastX

lastX: number = 0
  • Defined in view/plugin/TooltipHandler.ts:127

lastY

lastY: number = 0
  • Defined in view/plugin/TooltipHandler.ts:128

node

node: any
  • Defined in view/plugin/TooltipHandler.ts:131

state

state: CellState | null = null
  • Defined in view/plugin/TooltipHandler.ts:129

stateSource

stateSource: boolean = false
  • Defined in view/plugin/TooltipHandler.ts:130

thread

thread: number | null = null
  • Defined in view/plugin/TooltipHandler.ts:132

zIndex

zIndex: number = 10005

Specifies the zIndex for the tooltip and its shadow.

Default

10005
  • Defined in view/plugin/TooltipHandler.ts:97

StaticpluginId

pluginId: string = 'TooltipHandler'
  • Defined in view/plugin/TooltipHandler.ts:47

Methods

getStateForEvent

  • getStateForEvent(me: InternalMouseEvent): CellState | null

    Returns the CellState. to be used for showing a tooltip for this event.

    Parameters

    • me: InternalMouseEvent

    Returns CellState | null

    • Defined in view/plugin/TooltipHandler.ts:175

getTooltip

  • getTooltip(
        state: CellState,
        node: HTMLElement | SVGElement,
        x: number,
        y: number,
    ): string | HTMLElement | null

    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 string | HTMLElement | null

    Since

    0.23.0

    • Defined in view/plugin/TooltipHandler.ts:345

getTooltipForCell

  • getTooltipForCell(cell: Cell): string

    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

    Since

    0.23.0

    • Defined in view/plugin/TooltipHandler.ts:412

hide

  • hide(): void

    Hides the tooltip and resets the timer.

    Returns void

    • Defined in view/plugin/TooltipHandler.ts:270

hideTooltip

  • hideTooltip(): void

    Hides the tooltip.

    Returns void

    • Defined in view/plugin/TooltipHandler.ts:278

init

  • init(): void

    Creates the tooltip element and appends it to the document body.

    Returns void

    • Defined in view/plugin/TooltipHandler.ts:53

isEnabled

  • isEnabled(): boolean

    Returns true if events are handled.

    This implementation returns enabled.

    Returns boolean

    • Defined in view/plugin/TooltipHandler.ts:145

isHideOnHover

  • isHideOnHover(): boolean

    Returns hideOnHover.

    Returns boolean

    • Defined in view/plugin/TooltipHandler.ts:161

mouseDown

  • mouseDown(_sender: EventSource, me: InternalMouseEvent): void

    Parameters

    • _sender: EventSource
    • me: InternalMouseEvent

    Returns void

    Implementation of MouseListenerSet.mouseDown

    • Defined in view/plugin/TooltipHandler.ts:179

mouseMove

  • mouseMove(_sender: EventSource, me: InternalMouseEvent): void

    Parameters

    • _sender: EventSource
    • me: InternalMouseEvent

    Returns void

    Implementation of MouseListenerSet.mouseMove

    • Defined in view/plugin/TooltipHandler.ts:184

mouseUp

  • mouseUp(_sender: EventSource, me: InternalMouseEvent): void

    Handles the event by resetting the tooltip timer or hiding the existing tooltip.

    Parameters

    • _sender: EventSource
    • me: InternalMouseEvent

    Returns void

    Implementation of MouseListenerSet.mouseUp

    • Defined in view/plugin/TooltipHandler.ts:209

onDestroy

  • onDestroy(): void

    Destroys the handler and all its resources and DOM nodes.

    Returns void

    Implementation of GraphPlugin.onDestroy

    • Defined in view/plugin/TooltipHandler.ts:314

reset

  • reset(me: InternalMouseEvent, restart: boolean, state?: CellState | null): void

    Resets and/or restarts the timer to trigger the display of the tooltip.

    Parameters

    • me: InternalMouseEvent
    • restart: boolean
    • state: CellState | null = null

    Returns void

    • Defined in view/plugin/TooltipHandler.ts:227

resetTimer

  • resetTimer(): void

    Resets the timer.

    Returns void

    • Defined in view/plugin/TooltipHandler.ts:217

setEnabled

  • setEnabled(enabled: boolean): void

    Enables or disables event handling.

    This implementation updates enabled.

    Parameters

    • enabled: boolean

    Returns void

    • Defined in view/plugin/TooltipHandler.ts:154

setHideOnHover

  • setHideOnHover(value: boolean): void

    Sets hideOnHover.

    Parameters

    • value: boolean

    Returns void

    • Defined in view/plugin/TooltipHandler.ts:168

show

  • show(tip: string | HTMLElement | null, x: number, y: number): void

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

    Parameters

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

    Returns void

    • Defined in view/plugin/TooltipHandler.ts:289

Settings

Member Visibility
  • Protected
  • Inherited
Theme

On This Page

Constructors
constructor
Properties
delaydestroyeddivenabledgraphhideOnHoverignoreTouchEventslastXlastYnodestatestateSourcethreadzIndexpluginId
Methods
getStateForEventgetTooltipgetTooltipForCellhidehideTooltipinitisEnabledisHideOnHovermouseDownmouseMovemouseUponDestroyresetresetTimersetEnabledsetHideOnHovershow
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.