Skip to content

Commit 176024f

Browse files
refactor(imgui): update textLabel to use geom types
1 parent 5dfd391 commit 176024f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/imgui/src/components/textlabel.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Fn, Maybe } from "@thi.ng/api";
22
import { isPlainObject } from "@thi.ng/checks/is-plain-object";
3+
import { text } from "@thi.ng/geom/text";
34
import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
45
import type { ReadonlyVec } from "@thi.ng/vectors";
56
import type { Color, GUITheme } from "../api.js";
@@ -16,19 +17,20 @@ export const textLabel = (
1617
const theme = gui.theme;
1718
const { x, y, h } = layoutBox(layout);
1819
gui.draw &&
19-
gui.add([
20-
"text",
21-
{ fill: gui.textColor(false) },
22-
[x + (pad ? theme.pad : 0), y + h / 2 + theme.baseLine],
23-
label,
24-
]);
20+
gui.add(
21+
text(
22+
[x + (pad ? theme.pad : 0), y + h / 2 + theme.baseLine],
23+
label,
24+
{ fill: gui.textColor(false) }
25+
)
26+
);
2527
};
2628

2729
export const textLabelRaw = (
2830
p: ReadonlyVec,
2931
attribs: Color | any,
3032
label: string
31-
) => ["text", isPlainObject(attribs) ? attribs : { fill: attribs }, p, label];
33+
) => text(p, label, isPlainObject(attribs) ? attribs : { fill: attribs });
3234

3335
export const textTransformH = (
3436
theme: GUITheme,

0 commit comments

Comments
 (0)