diff --git a/ActionTimelineEx/Plugin.cs b/ActionTimelineEx/Plugin.cs index 390fcb0..77524b8 100644 --- a/ActionTimelineEx/Plugin.cs +++ b/ActionTimelineEx/Plugin.cs @@ -67,7 +67,7 @@ public class Plugin : IDalamudPlugin public Plugin(IDalamudPluginInterface pluginInterface) { ECommonsMain.Init(pluginInterface, this); - XIVConfigUIMain.Init(pluginInterface, "/atle", "Opens the ActionTimelineEx configuration window.\n\"/atle reset\" to reset the rotation helper count.\n\"/atle toggle\" to toggle the rotation helper's visibility.", PluginCommand, typeof(Settings), typeof(DrawingSettings), typeof(GroupItem), typeof(UiString)); + XIVConfigUIMain.Init(pluginInterface, "/atle", "Opens the ActionTimelineEx configuration window.\n\"/atle reset\" to reset the rotation helper count.", PluginCommand, typeof(Settings), typeof(DrawingSettings), typeof(GroupItem), typeof(UiString)); XIVDrawerMain.Init(pluginInterface, "ActionTimelineExOverlay"); Svc.PluginInterface.UiBuilder.Draw += Draw; @@ -116,9 +116,6 @@ public static void PluginCommand(string str) case "reset": RotationHelper.Clear(); return; - case "toggle": - RotationHelperWindow._open = !RotationHelperWindow._open; - return; } _settingsWindow.Toggle(); } diff --git a/ActionTimelineEx/Windows/RotationHelperWindow.cs b/ActionTimelineEx/Windows/RotationHelperWindow.cs index b6dbd68..a065ca7 100644 --- a/ActionTimelineEx/Windows/RotationHelperWindow.cs +++ b/ActionTimelineEx/Windows/RotationHelperWindow.cs @@ -9,9 +9,6 @@ namespace ActionTimelineEx.Windows; internal static class RotationHelperWindow { - private static Vector2 _size = default; - internal static bool _open = true; - private static bool _changed = false; public static void Draw() { var setting = Plugin.Settings; @@ -28,71 +25,43 @@ public static void Draw() { flag |= ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove; } - if (!_open) - { - flag |= ImGuiWindowFlags.AlwaysAutoResize; - } + Vector4 bgColor = setting.RotationLocked ? setting.RotationLockedBackgroundColor : setting.RotationUnlockedBackgroundColor; using var bgColorPush = ImRaii.PushColor(ImGuiCol.WindowBg, bgColor); ImGui.SetNextWindowSize(new Vector2(560, 100) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver); - if (_changed) - { - ImGui.SetNextWindowSize(_size); - _changed = false; - } - if (ImGui.Begin("Rotation Helper Window", flag)) { var rotations = Plugin.Settings.RotationHelper; - if (ImGui.Checkbox("##Open", ref _open)) + var index = rotations.ChoiceIndex; + if (ImGuiHelper.SelectableCombo("Change Rotation", [.. rotations.RotationSettings.Select(i => i.Name)], ref index)) { - if (_open) - { - _changed = true; - ImGui.End(); - return; - } - else - { - _size = ImGui.GetWindowSize(); - } + rotations.ChoiceIndex = index; } - var heightReduce = ImGui.GetCursorPosY(); - - if (_open) + //Double click to clear. + if (DrawHelper.IsInRect(ImGui.GetWindowPos(), ImGui.GetWindowSize()) && ImGui.IsMouseDoubleClicked(ImGuiMouseButton.Left)) { - ImGui.SameLine(); - var index = rotations.ChoiceIndex; - if (ImGuiHelper.SelectableCombo("Change Rotation", [.. rotations.RotationSettings.Select(i => i.Name)], ref index)) - { - rotations.ChoiceIndex = index; - } - - //Double click to clear. - if (DrawHelper.IsInRect(ImGui.GetWindowPos(), ImGui.GetWindowSize()) && ImGui.IsMouseDoubleClicked(ImGuiMouseButton.Left)) - { - RotationHelper.Clear(); - } + RotationHelper.Clear(); + } - var padding = ImGui.GetStyle().WindowPadding; - var border = ImGui.GetStyle().WindowBorderSize; - ImGui.GetStyle().WindowPadding = default; - ImGui.GetStyle().WindowBorderSize = 0; - try - { - RotationHelper.RotationSetting.Draw(heightReduce); - } - finally - { - ImGui.End(); - ImGui.GetStyle().WindowPadding = padding; - ImGui.GetStyle().WindowBorderSize = border; - } + var heightReduce = ImGui.GetCursorPosY(); + var padding = ImGui.GetStyle().WindowPadding; + var border = ImGui.GetStyle().WindowBorderSize; + ImGui.GetStyle().WindowPadding = default; + ImGui.GetStyle().WindowBorderSize = 0; + try + { + RotationHelper.RotationSetting.Draw(heightReduce); + } + finally + { + ImGui.End(); + ImGui.GetStyle().WindowPadding = padding; + ImGui.GetStyle().WindowBorderSize = border; } } }