Linedefs Mode: fixed a problem where flipping a highlighted linedef would also select the linedef. Fixes #571

This commit is contained in:
biwa 2021-05-30 18:27:56 +02:00 committed by spherallic
parent af365fed73
commit 672e5ba6f6

View file

@ -1933,6 +1933,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
[BeginAction("fliplinedefs")] [BeginAction("fliplinedefs")]
public void FlipLinedefs() public void FlipLinedefs()
{ {
bool deselect = false;
// No selected lines? // No selected lines?
ICollection<Linedef> selected = General.Map.Map.GetSelectedLinedefs(true); ICollection<Linedef> selected = General.Map.Map.GetSelectedLinedefs(true);
if(selected.Count == 0) if(selected.Count == 0)
@ -1943,6 +1945,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Select the highlighted item // Select the highlighted item
highlighted.Selected = true; highlighted.Selected = true;
selected.Add(highlighted); selected.Add(highlighted);
// If nothing was selected we want to deselect the highlighted line when we're done
deselect = true;
} }
} }
@ -1967,6 +1972,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
General.Interface.DisplayStatus(StatusType.Warning, (selectedcount > 1 ? "Selected linedefs already point in the right direction!" General.Interface.DisplayStatus(StatusType.Warning, (selectedcount > 1 ? "Selected linedefs already point in the right direction!"
: "Selected linedef already points in the right direction!")); : "Selected linedef already points in the right direction!"));
// There might be linedefs that were filtered out, so deselect all linedefs (if necessary) anyway
if (deselect)
General.Map.Map.ClearSelectedLinedefs();
return; return;
} }
@ -1989,6 +1999,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
l.FlipSidedefs(); l.FlipSidedefs();
} }
if(deselect)
General.Map.Map.ClearSelectedLinedefs();
// Redraw // Redraw
General.Map.Map.Update(); General.Map.Map.Update();
General.Map.IsChanged = true; General.Map.IsChanged = true;