Skip to content

Commit

Permalink
feat(imgui): add cursor blink config, update textFieldRaw()
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Aug 13, 2019
1 parent 765a9ac commit 1d80e14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/imgui/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface GUITheme {
pad: number;
focus: Color;
cursor: Color;
cursorBlink: number;
bg: Color;
fg: Color;
text: Color;
Expand Down Expand Up @@ -147,6 +148,7 @@ export const DEFAULT_THEME: GUITheme = {
globalBg: "#ccc",
focus: [0, 1, 0, 1],
cursor: [0, 0, 0, 1],
cursorBlink: 2,
bg: [1, 1, 1, 0.66],
fg: [0.2, 0.8, 1, 1],
text: [0.3, 0.3, 0.3, 1],
Expand Down
2 changes: 1 addition & 1 deletion packages/imgui/src/components/textfield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const textFieldRaw = (
const cursor = label[1] || 0;
const drawCursor = Math.min(cursor - offset, maxLen);
const xx = x + pad + drawCursor * cw;
gui.time % 0.5 < 0.25 &&
(gui.time * theme.cursorBlink) % 1 < 0.5 &&
gui.add([
"line",
{ stroke: theme.cursor },
Expand Down

0 comments on commit 1d80e14

Please sign in to comment.