Skip to content

Commit

Permalink
better checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
saint11 committed May 13, 2024
1 parent 8a59282 commit 5c60706
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Murder.Editor/Utilities/Gui/ImGuiHelpers.cs
Expand Up @@ -554,7 +554,16 @@ public static bool DrawEnumFieldAsFlagList(string id, string? emptyText, string?

bool isChecked = (value & intValue) != 0;

if (ImGui.Checkbox($"##{id}-{i}-layer", ref isChecked))
bool changed = false;
changed |= ImGui.Checkbox($"##{id}-{i}-layer", ref isChecked);
ImGui.SameLine();
if (ImGui.Selectable(prettyNames[i], isChecked, ImGuiSelectableFlags.DontClosePopups))
{
changed = true;
isChecked = !isChecked;
}

if (changed)
{
if (isChecked)
{
Expand All @@ -568,8 +577,6 @@ public static bool DrawEnumFieldAsFlagList(string id, string? emptyText, string?
modified = true;
}

ImGui.SameLine();
ImGui.Text(prettyNames[i]);
}
ImGui.EndCombo();
}
Expand Down

0 comments on commit 5c60706

Please sign in to comment.