blockly > Tooltip

Tooltip namespace


Function Description
bindMouseEvents(element) Binds the required mouse events onto an SVG element.
createDom() Create the tooltip div and inject it onto the page.
getCustomTooltip() Gets the custom tooltip function.
getDiv() Returns the HTML tooltip container.
getTooltipOfObject(object) Returns the tooltip text for the given element.
hide() Hide the tooltip.
isVisible() Returns whether or not a tooltip is showing
setCustomTooltip(customFn) Sets a custom function that will be called if present instead of the default tooltip UI.
unbindMouseEvents(element) Unbinds tooltip mouse events from the SVG element.


Variable Description
HOVER_MS Delay before tooltip appears.
LIMIT Maximum width (in characters) of a tooltip.
MARGINS Horizontal padding between tooltip and screen edge.
OFFSET_X Horizontal offset between mouse cursor and tooltip.
OFFSET_Y Vertical offset between mouse cursor and tooltip.
RADIUS_OK Radius mouse can move before killing tooltip.

Type Aliases

Type Alias Description
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 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.