Move macros instead of swapping

This commit is contained in:
Asriel Camora
2023-11-18 01:07:31 -08:00
parent d186c426b3
commit 9bb76467b9
2 changed files with 10 additions and 1 deletions
+9
View File
@@ -119,6 +119,15 @@ public class Configuration : IPluginConfiguration
OnMacroListChanged?.Invoke(); OnMacroListChanged?.Invoke();
} }
public void MoveMacro(int fromIdx, int toIdx)
{
var macro = macros[fromIdx];
macros.RemoveAt(fromIdx);
macros.Insert(toIdx, macro);
Save();
OnMacroListChanged?.Invoke();
}
public void Save() => public void Save() =>
Service.PluginInterface.SavePluginConfig(this); Service.PluginInterface.SavePluginConfig(this);
} }
+1 -1
View File
@@ -96,7 +96,7 @@ public sealed class MacroList : Window, IDisposable
if (_target) if (_target)
{ {
if (ImGuiExtras.AcceptDragDropPayload("macroListItem", out int j)) if (ImGuiExtras.AcceptDragDropPayload("macroListItem", out int j))
Service.Configuration.SwapMacros(i, j); Service.Configuration.MoveMacro(j, i);
} }
} }
} }