/// <summary> /// Removes selected tile /// </summary> public void RemoveSelection() { if (_pixels.Count <= 0 || _source <= -1) { return; } int size = SnapSize.Width * SnapSize.Height; _pixels.RemoveRange(_source * size, size); TilesChanged?.Invoke(); DeselectSelection(); }
/// <summary> /// Swaps tiles from the selection grid /// </summary> private void SwapTiles() { if (_target == -1 || _source == -1 || _target == _source) { DeselectSelection(); return; } int size = SnapSize.Width * SnapSize.Height; List <byte> source = Tileset.GetTilePixels(_source, _pixels); _pixels.RemoveRange(_source * size, size); List <byte> target = Tileset.GetTilePixels(_target, _pixels); _pixels.RemoveRange(_target * size, size); _pixels.InsertRange(_target * size, source); _pixels.InsertRange(_source * size, target); TilesChanged?.Invoke(); DeselectSelection(); }