mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Fix labels appearing where unwanted.
This commit is contained in:
parent
ff6905d45e
commit
53388739ca
1 changed files with 12 additions and 6 deletions
|
|
@ -47,14 +47,20 @@ public static class UiHelpers
|
||||||
|
|
||||||
public static bool DrawCheckbox(string label, string tooltip, bool value, out bool on, bool locked)
|
public static bool DrawCheckbox(string label, string tooltip, bool value, out bool on, bool locked)
|
||||||
{
|
{
|
||||||
|
var startsWithHash = label.StartsWith("##");
|
||||||
bool ret;
|
bool ret;
|
||||||
using (var disabled = ImRaii.Disabled(locked))
|
using (_ = ImRaii.Disabled(locked))
|
||||||
{
|
{
|
||||||
ret = ImGuiUtil.Checkbox("##" + label, string.Empty, value, v => value = v);
|
ret = ImGuiUtil.Checkbox(startsWithHash ? label : "##" + label, string.Empty, value, v => value = v);
|
||||||
}
|
}
|
||||||
ImGui.SameLine(0, ImGui.GetStyle().ItemInnerSpacing.X);
|
|
||||||
ImGui.AlignTextToFramePadding();
|
if (!startsWithHash)
|
||||||
ImGui.TextUnformatted(label);
|
{
|
||||||
|
ImGui.SameLine(0, ImGui.GetStyle().ItemInnerSpacing.X);
|
||||||
|
ImGui.AlignTextToFramePadding();
|
||||||
|
ImGui.TextUnformatted(label);
|
||||||
|
}
|
||||||
|
|
||||||
ImGuiUtil.HoverTooltip(tooltip, ImGuiHoveredFlags.AllowWhenDisabled);
|
ImGuiUtil.HoverTooltip(tooltip, ImGuiHoveredFlags.AllowWhenDisabled);
|
||||||
on = value;
|
on = value;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -63,7 +69,7 @@ public static class UiHelpers
|
||||||
public static (bool, bool) DrawMetaToggle(string label, bool currentValue, bool currentApply, out bool newValue,
|
public static (bool, bool) DrawMetaToggle(string label, bool currentValue, bool currentApply, out bool newValue,
|
||||||
out bool newApply, bool locked)
|
out bool newApply, bool locked)
|
||||||
{
|
{
|
||||||
var flags = (sbyte)(currentApply ? currentValue ? 1 : -1 : 0);
|
var flags = (sbyte)(currentApply ? currentValue ? 1 : -1 : 0);
|
||||||
using (_ = ImRaii.Disabled(locked))
|
using (_ = ImRaii.Disabled(locked))
|
||||||
{
|
{
|
||||||
if (new TristateCheckbox(ColorId.TriStateCross.Value(), ColorId.TriStateCheck.Value(), ColorId.TriStateNeutral.Value()).Draw(
|
if (new TristateCheckbox(ColorId.TriStateCross.Value(), ColorId.TriStateCheck.Value(), ColorId.TriStateNeutral.Value()).Draw(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue