Move macros instead of swapping
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user