From 28df880cd53db49ff4427eefbee44dd220de15a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Mon, 10 Apr 2023 23:47:42 +0800 Subject: [PATCH] fix: fixed cooldown cover size. --- RotationSolver/UI/ControlWindow.cs | 11 +++++++---- RotationSolver/UI/CooldownWindow.cs | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/RotationSolver/UI/ControlWindow.cs b/RotationSolver/UI/ControlWindow.cs index 2c791694a..afe903df1 100644 --- a/RotationSolver/UI/ControlWindow.cs +++ b/RotationSolver/UI/ControlWindow.cs @@ -414,9 +414,9 @@ static void DrawIAction(nint handle, string id, float width, StateCommandType co } } - internal static void DrawIAction(IAction action, float width, float percent) + internal static (Vector2, Vector2) DrawIAction(IAction action, float width, float percent) { - DrawIAction(GetTexture(action).ImGuiHandle, width, action == null ? -1 : percent); + var result = DrawIAction(GetTexture(action).ImGuiHandle, width, action == null ? -1 : percent); if (action != null) ImGuiHelper.HoveredString(action.Name, () => { if (DataCenter.StateType == StateCommandType.Cancel) @@ -428,15 +428,17 @@ internal static void DrawIAction(IAction action, float width, float percent) DataCenter.AddCommandAction(action, 5); } }); + return result; } - static void DrawIAction(nint handle, float width, float percent) + static (Vector2, Vector2) DrawIAction(nint handle, float width, float percent) { var cursor = ImGui.GetCursorPos(); ImGui.BeginGroup(); + var pt = ImGui.GetCursorPos(); ImGui.Image(handle, new Vector2(width, width)); - + var size = ImGui.GetItemRectSize(); var pixPerUnit = width / 82; if (percent < 0) @@ -515,6 +517,7 @@ static void DrawIAction(nint handle, float width, float percent) ImGui.EndGroup(); + return (pt, size); } static unsafe void DrawNextAction(float gcd, float ability, float width) diff --git a/RotationSolver/UI/CooldownWindow.cs b/RotationSolver/UI/CooldownWindow.cs index 536eb74bb..19971ce3c 100644 --- a/RotationSolver/UI/CooldownWindow.cs +++ b/RotationSolver/UI/CooldownWindow.cs @@ -48,7 +48,6 @@ private static void DrawActionCooldown(IAction act) var shouldSkip = recast < 3 && act is IBaseAction a && !a.IsRealGCD; ImGui.BeginGroup(); - var pos = ImGui.GetCursorPos(); var winPos = ImGui.GetWindowPos(); var r = -1f; @@ -56,8 +55,9 @@ private static void DrawActionCooldown(IAction act) { r = !act.EnoughLevel ? 0: recast == 0 || !act.IsCoolingDown || shouldSkip ? 1 : elapsed / recast; } - ControlWindow.DrawIAction(act, width, r); - var size = ImGui.GetItemRectSize(); + var pair = ControlWindow.DrawIAction(act, width, r); + var pos = pair.Item1; + var size = pair.Item2; ImGuiHelper.HoveredString(act.Name + "\n" + LocalizationManager.RightLang.ConfigWindow_Control_ClickToUse); if (!act.EnoughLevel)