Namespace: Tooltip

Stay organized with collections Save and categorize content based on your preferences.

Properties

DIV

static

HTMLDivElement

The HTML container. Set once by createDom.

Deprecated
Use Blockly.Tooltip.getDiv() and .setDiv(). (September 2021)

HOVER_MS

constant   static

Delay before tooltip appears.

LIMIT

constant   static

Maximum width (in characters) of a tooltip.

MARGINS

constant   static

Horizontal padding between tooltip and screen edge.

OFFSET_X

constant   static

Horizontal offset between mouse cursor and tooltip.

OFFSET_Y

constant   static

Vertical offset between mouse cursor and tooltip.

RADIUS_OK

constant   static

Radius mouse can move before killing tooltip.

visible

static

boolean

Is a tooltip currently showing?

Deprecated
Use Blockly.Tooltip.isVisible() instead. (September 2021)

Methods

bindMouseEvents

static

bindMouseEvents(element)

Binds the required mouse events onto an SVG element.

Parameter

element

Element

SVG element onto which tooltip is to be bound.

Value must not be null.

block

package   static

block()

Hide any in-progress tooltips and block showing new tooltips until the next call to unblock().

createDom

static

createDom()

Create the tooltip div and inject it onto the page.

dispose

package   static

dispose()

Dispose of the tooltip.

getDiv

static

getDiv() returns HTMLDivElement

Returns the HTML tooltip container.

Returns

nullable HTMLDivElement The HTML tooltip container.

getTooltipOfObject

static

getTooltipOfObject(object) returns string

Returns the tooltip text for the given element.

Parameter

object

Object

The object to get the tooltip text of.

Value may be null.

Returns

string The tooltip text of the element.

hide

static

hide()

Hide the tooltip.

isVisible

static

isVisible() returns boolean

Returns whether or not a tooltip is showing

Returns

boolean True if a tooltip is showing

setCustomTooltip

static

setCustomTooltip(customFn)

Sets a custom function that will be called if present instead of the default tooltip UI.

Parameter

customFn

CustomTooltip

A custom tooltip used to render an alternate tooltip UI.

Value must not be null.

unbindMouseEvents

static

unbindMouseEvents(element)

Unbinds tooltip mouse events from the SVG element.

Parameter

element

Element

SVG element onto which tooltip is bound.

Value must not be null.

unblock

package   static

unblock()

Unblock tooltips: allow them to be scheduled and shown according to their own logic.

Abstract types

CustomTooltip

static

CustomTooltip()

A function that renders custom tooltip UI. 1st parameter: the div element to render content into. 2nd parameter: the element being moused over (i.e., the element for which the tooltip should be shown).

TipInfo

static

TipInfo()

A type which can define a tooltip. Either a string, an object containing a tooltip property, or a function which returns either a string, or another arbitrarily nested function which eventually unwinds to a string.