UNPKG

lazy-widgets

Version:

Typescript retained mode GUI for the HTML canvas API

22 lines 1.03 kB
import { BaseTooltipController } from './BaseTooltipController.js'; /** * The default implementation of {@link BaseTooltipController}. Used by * {@link TooltipContainer}, which lets you provide an anchor point to position * the tooltip around. */ export class TooltipController extends BaseTooltipController { addLayer(relAnchorPos) { const added = super.addLayer(relAnchorPos); if (added) { // get anchor pos and this widget relative to layerered container. // update tooltip widget with these positions [this.tooltipContainer.anchorX, this.tooltipContainer.anchorY] = this.tooltipWrapper.queryPointFromHere(relAnchorPos[0], relAnchorPos[1], this.topLayeredContainer); this.updateTooltipRect(); } return added; } doTooltipRectUpdate() { this.tooltipContainer.tooltipRect = this.tooltipWrapper.queryRectFromHere(this.tooltipWrapper.idealRect, this.topLayeredContainer); } } //# sourceMappingURL=TooltipController.js.map