|
@@ -6,30 +6,38 @@ using PixiEditor.Models.Undo;
|
|
|
|
|
|
namespace PixiEditor.Helpers
|
|
namespace PixiEditor.Helpers
|
|
{
|
|
{
|
|
- public class SelectionHelpers
|
|
|
|
|
|
+ public static class SelectionHelpers
|
|
{
|
|
{
|
|
- public static void SelectionSet(object[] arguments)
|
|
|
|
- {
|
|
|
|
- Document document = (Document)arguments[0];
|
|
|
|
-
|
|
|
|
- document.ActiveSelection.SetSelection((IEnumerable<Coordinates>)arguments[1], SelectionType.New);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public static void AddSelectionUndoStep(Document document, IEnumerable<Coordinates> oldPoints, SelectionType mode)
|
|
public static void AddSelectionUndoStep(Document document, IEnumerable<Coordinates> oldPoints, SelectionType mode)
|
|
{
|
|
{
|
|
|
|
+#pragma warning disable SA1117 // Parameters should be on same line or separate lines. Justification: Making it readable
|
|
if (mode == SelectionType.New && document.ActiveSelection.SelectedPoints.Count != 0)
|
|
if (mode == SelectionType.New && document.ActiveSelection.SelectedPoints.Count != 0)
|
|
{
|
|
{
|
|
// Add empty selection as the old one get's fully deleted first
|
|
// Add empty selection as the old one get's fully deleted first
|
|
document.UndoManager.AddUndoChange(
|
|
document.UndoManager.AddUndoChange(
|
|
- new Change(SelectionSet, new object[] { document, new List<Coordinates>(oldPoints) }, SelectionSet, new object[] { document, new List<Coordinates>() }));
|
|
|
|
|
|
+ new Change(
|
|
|
|
+ SetSelectionProcess, new object[] { document, new List<Coordinates>(oldPoints) },
|
|
|
|
+ SetSelectionProcess, new object[] { document, new List<Coordinates>() }));
|
|
document.UndoManager.AddUndoChange(
|
|
document.UndoManager.AddUndoChange(
|
|
- new Change(SelectionSet, new object[] { document, new List<Coordinates>() }, SelectionSet, new object[] { document, new List<Coordinates>(document.ActiveSelection.SelectedPoints) }));
|
|
|
|
|
|
+ new Change(
|
|
|
|
+ SetSelectionProcess, new object[] { document, new List<Coordinates>() },
|
|
|
|
+ SetSelectionProcess, new object[] { document, new List<Coordinates>(document.ActiveSelection.SelectedPoints) }));
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
document.UndoManager.AddUndoChange(
|
|
document.UndoManager.AddUndoChange(
|
|
- new Change(SelectionSet, new object[] { document, new List<Coordinates>(oldPoints) }, SelectionSet, new object[] { document, new List<Coordinates>(document.ActiveSelection.SelectedPoints) }));
|
|
|
|
|
|
+ new Change(
|
|
|
|
+ SetSelectionProcess, new object[] { document, new List<Coordinates>(oldPoints) },
|
|
|
|
+ SetSelectionProcess, new object[] { document, new List<Coordinates>(document.ActiveSelection.SelectedPoints) }));
|
|
|
|
+#pragma warning restore SA1117 // Parameters should be on same line or separate lines
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private static void SetSelectionProcess(object[] arguments)
|
|
|
|
+ {
|
|
|
|
+ Document document = (Document)arguments[0];
|
|
|
|
+
|
|
|
|
+ document.ActiveSelection.SetSelection((IEnumerable<Coordinates>)arguments[1], SelectionType.New);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|