Skip to content

Commit

Permalink
Flip/Rotate: Ignore Mode Light
Browse files Browse the repository at this point in the history
  • Loading branch information
mat1jaczyyy committed Aug 18, 2020
1 parent bba7b34 commit c29f6ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Apollo/Devices/Flip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public Flip(FlipType mode = FlipType.Horizontal, bool bypass = false): base("fli
}

public override void MIDIProcess(List<Signal> n)
=> InvokeExit((Bypass? n.Select(i => i.Clone()) : Enumerable.Empty<Signal>()).Concat(n.Select(i => {
=> InvokeExit((Bypass? n.Select(i => i.Clone()) : Enumerable.Empty<Signal>()).Concat(n.SelectMany(i => {
if (i.Index == 100)
return Bypass? Enumerable.Empty<Signal>() : new [] {i};

int x = i.Index % 10;
int y = i.Index / 10;

Expand All @@ -64,7 +67,7 @@ public override void MIDIProcess(List<Signal> n)
}

i.Index = (byte)(y * 10 + x);
return i;
return new [] {i};
})).ToList());

public class ModeUndoEntry: EnumSimplePathUndoEntry<Flip, FlipType> {
Expand Down
7 changes: 5 additions & 2 deletions Apollo/Devices/Rotate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public Rotate(RotateType mode = RotateType.D90, bool bypass = false): base("rota
}

public override void MIDIProcess(List<Signal> n)
=> InvokeExit((Bypass? n.Select(i => i.Clone()) : Enumerable.Empty<Signal>()).Concat(n.Select(i => {
=> InvokeExit((Bypass? n.Select(i => i.Clone()) : Enumerable.Empty<Signal>()).Concat(n.SelectMany(i => {
if (i.Index == 100)
return Bypass? Enumerable.Empty<Signal>() : new [] {i};

if (Mode == RotateType.D90)
i.Index = (byte)((9 - i.Index % 10) * 10 + i.Index / 10);

Expand All @@ -52,7 +55,7 @@ public override void MIDIProcess(List<Signal> n)
else if (Mode == RotateType.D270)
i.Index = (byte)((i.Index % 10) * 10 + 9 - i.Index / 10);

return i;
return new [] {i};
})).ToList());

public class ModeUndoEntry: EnumSimplePathUndoEntry<Rotate, RotateType> {
Expand Down

0 comments on commit c29f6ba

Please sign in to comment.