GeezerVison is showing maxgraph.github.io — TooltipHandler | @maxgraph/core
Constructors
constructor
-
Constructs an event handler that displays tooltips.
Returns TooltipHandler
Properties
delay
delay: number = 500
Delay to show the tooltip in milliseconds.
destroyed
destroyed: boolean = false
true if this handler was destroyed using onDestroy.
Optionaldiv
div?: HTMLElement | null
enabled
enabled: boolean = false
Specifies if events are handled.
hideOnHover
hideOnHover: boolean = false
Specifies if the tooltip should be hidden if the mouse is moved over the current cell.
ignoreTouchEvents
ignoreTouchEvents: boolean = true
Specifies if touch and pen events should be ignored.
stateSource
stateSource: boolean = false
thread
thread: number | null = null
zIndex
zIndex: number = 10005
Specifies the zIndex for the tooltip and its shadow.
StaticpluginId
pluginId: string = 'TooltipHandler'
Methods
getStateForEvent
-
Returns the CellState. to be used for showing a tooltip for this event.
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
- 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
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
hide
-
Hides the tooltip and resets the timer.
Returns void
init
-
Creates the tooltip element and appends it to the document body.
Returns void
isEnabled
-
Returns true if events are handled.
This implementation returns enabled.
Returns boolean
mouseUp
-
Handles the event by resetting the tooltip timer or hiding the existing tooltip.
Returns void
onDestroy
-
Destroys the handler and all its resources and DOM nodes.
Returns void
reset
-
Resets and/or restarts the timer to trigger the display of the tooltip.
Returns void
setEnabled
-
setEnabled(enabled: boolean): void
Enables or disables event handling.
This implementation updates enabled.
Returns void
setHideOnHover
-
setHideOnHover(value: boolean): void
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
On This Page
Constructors
Properties
Methods