Implemented mod: MoveSprite
This commit is contained in:
@@ -19,7 +19,6 @@ namespace AnimationEditor.Modifications
|
||||
private BindingList<Sprite> sprites;
|
||||
private ListBox listBox;
|
||||
private List<int> indices;
|
||||
private Dictionary<int, Vector2> originalPositions;
|
||||
private Vector2 dist;
|
||||
|
||||
public MoveSprite(BindingList<Sprite> spriteList, ListBox spriteListBox, Vector2 distance)
|
||||
@@ -27,12 +26,6 @@ namespace AnimationEditor.Modifications
|
||||
sprites = spriteList;
|
||||
listBox = spriteListBox;
|
||||
indices = new List<int>();
|
||||
originalPositions = new Dictionary<int, Vector2>();
|
||||
foreach (int i in spriteListBox.SelectedIndices)
|
||||
{
|
||||
indices.Add(i);
|
||||
originalPositions.Add(i, sprites[i].Offset);
|
||||
}
|
||||
dist = distance;
|
||||
}
|
||||
|
||||
@@ -48,7 +41,7 @@ namespace AnimationEditor.Modifications
|
||||
{
|
||||
foreach (int index in indices)
|
||||
{
|
||||
sprites[index].Offset = originalPositions[index];
|
||||
sprites[index].Offset -= dist;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace AnimationEditor.Modifications
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Move Sprite";
|
||||
return "Reorder Sprite";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AnimationEditor.Modifications
|
||||
{
|
||||
class SpriteDragArgs : EventArgs
|
||||
{
|
||||
public Vector2 DragDistance { get; private set; }
|
||||
|
||||
public SpriteDragArgs(Vector2 drag)
|
||||
{
|
||||
DragDistance = drag;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user