UNPKG

lazy-widgets

Version:

Typescript retained mode GUI for the HTML canvas API

44 lines (43 loc) 1.87 kB
import { PassthroughWidget } from './PassthroughWidget.js'; import { TooltipContainer } from './TooltipContainer.js'; import { WidgetEvent } from '../events/WidgetEvent.js'; import type { Widget, WidgetProperties } from './Widget.js'; import type { WidgetAutoXML } from '../xml/WidgetAutoXML.js'; /** * Wraps a widget and provides a tooltip. Automatically manages a given * {@link TooltipContainer}, which will be used as the actual visual tooltip. * * Whenever this widget is hovered for a small amount of time without moving * the pointer too much, a new layer will be created with the passed * {@link TooltipContainer}, in the top-most {@link LayeredContainer}. * Unhovering this wrapper will remove the layer. * * Has a tolerance for small movements, so that shaky pointers can still be used * to detect hovering. * * @category Widget */ export declare class Tooltip<W extends Widget = Widget, T extends TooltipContainer = TooltipContainer> extends PassthroughWidget<W> { static autoXML: WidgetAutoXML; /** * The timestamp for when the hovering started. 0 if not hovering. For * internal use only. */ private _hoverStart; /** * The pointer position for when the hovering started. For internal use * only. */ private _hoverStartPos; /** The actual tooltip that will be shown when this wrapper is hovered. */ readonly tooltipWidget: T; /** The tooltip controller used for managing tooltip visibility. */ private readonly controller; constructor(child: W, tooltipWidget: T, properties?: Readonly<WidgetProperties>); protected handleAttachment(): void; protected handleDetachment(): void; protected handlePreLayoutUpdate(): void; protected handleEvent(event: WidgetEvent): Widget | null; resolvePosition(x: number, y: number): void; finalizeBounds(): void; }