@thi.ng/imgui
Version:
Immediate mode GUI with flexible state handling & data only shape output
21 lines (20 loc) • 506 B
JavaScript
import { rect } from "@thi.ng/geom/rect";
import { add2 } from "@thi.ng/vectors/add";
import { textLabelRaw } from "./textlabel.js";
const tooltipRaw = (gui, tooltip) => {
const theme = gui.theme;
const p = add2(null, [0, 10], gui.mouse);
gui.addOverlay(
rect(p, [tooltip.length * theme.charWidth + theme.pad, 20], {
fill: theme.bgTooltip
}),
textLabelRaw(
add2(null, [4, 10 + theme.baseLine], p),
theme.textTooltip,
tooltip
)
);
};
export {
tooltipRaw
};