diff --git a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs index 09e5e875..4bd62bd5 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs @@ -1078,19 +1078,18 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Start dragging the selection - if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag()) //mxd + if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag(draglines)) //mxd General.Editing.ChangeMode(new DragLinedefsMode(mousedownmappos, draglines)); } } } //mxd. Check if any selected linedef is outside of map boundary - private static bool CanDrag() + private static bool CanDrag(ICollection draglines) { - ICollection selectedlines = General.Map.Map.GetSelectedLinedefs(true); int unaffectedCount = 0; - foreach(Linedef l in selectedlines) + foreach(Linedef l in draglines) { // Make sure the linedef is inside the map boundary if(l.Start.Position.x < General.Map.Config.LeftBoundary || l.Start.Position.x > General.Map.Config.RightBoundary @@ -1098,21 +1097,22 @@ namespace CodeImp.DoomBuilder.BuilderModes || l.End.Position.x < General.Map.Config.LeftBoundary || l.End.Position.x > General.Map.Config.RightBoundary || l.End.Position.y > General.Map.Config.TopBoundary || l.End.Position.y < General.Map.Config.BottomBoundary) { - - l.Selected = false; unaffectedCount++; } } - if(unaffectedCount == selectedlines.Count) + if (unaffectedCount == draglines.Count) { - General.Interface.DisplayStatus(StatusType.Warning, "Unable to drag selection: " + (selectedlines.Count == 1 ? "selected linedef is" : "all of selected linedefs are") + " outside of map boundary!"); + General.Interface.DisplayStatus(StatusType.Warning, "Unable to drag selection: " + (draglines.Count == 1 ? "selected linedef is" : "all of selected linedefs are") + " outside of map boundary!"); General.Interface.RedrawDisplay(); return false; } - if(unaffectedCount > 0) + if (unaffectedCount > 0) + { General.Interface.DisplayStatus(StatusType.Warning, unaffectedCount + " of selected linedefs " + (unaffectedCount == 1 ? "is" : "are") + " outside of map boundary!"); + return false; + } return true; } diff --git a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs index 227ae03a..7deb7b6d 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs @@ -1333,19 +1333,18 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Start dragging the selection - if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag()) //mxd + if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag(dragsectors)) //mxd General.Editing.ChangeMode(new DragSectorsMode(mousedownmappos, dragsectors)); } } } //mxd. Check if any selected sector is outside of map boundary - private bool CanDrag() + private bool CanDrag(ICollection dragsectors) { - ICollection selectedsectors = General.Map.Map.GetSelectedSectors(true); int unaffectedCount = 0; - foreach(Sector s in selectedsectors) + foreach(Sector s in dragsectors) { // Make sure the sector is inside the map boundary foreach(Sidedef sd in s.Sidedefs) @@ -1355,24 +1354,25 @@ namespace CodeImp.DoomBuilder.BuilderModes || sd.Line.End.Position.x < General.Map.Config.LeftBoundary || sd.Line.End.Position.x > General.Map.Config.RightBoundary || sd.Line.End.Position.y > General.Map.Config.TopBoundary || sd.Line.End.Position.y < General.Map.Config.BottomBoundary) { - SelectSector(s, false, false); unaffectedCount++; break; } } } - if(unaffectedCount == selectedsectors.Count) + if (unaffectedCount == dragsectors.Count) { - General.Interface.DisplayStatus(StatusType.Warning, "Unable to drag selection: " + (selectedsectors.Count == 1 ? "selected sector is" : "all of selected sectors are") + " outside of map boundary!"); + General.Interface.DisplayStatus(StatusType.Warning, "Unable to drag selection: " + (dragsectors.Count == 1 ? "selected sector is" : "all of selected sectors are") + " outside of map boundary!"); General.Interface.RedrawDisplay(); return false; } - if(unaffectedCount > 0) + if (unaffectedCount > 0) + { General.Interface.DisplayStatus(StatusType.Warning, unaffectedCount + " of selected sectors " + (unaffectedCount == 1 ? "is" : "are") + " outside of map boundary!"); + return false; + } - UpdateSelectedLabels(); //mxd return true; } diff --git a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs index 5fb00a5f..7724f761 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs @@ -758,7 +758,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Start dragging the selection - if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag()) //mxd + if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag(dragthings)) //mxd { // Shift pressed? Clone things! bool thingscloned = false; @@ -819,31 +819,32 @@ namespace CodeImp.DoomBuilder.BuilderModes } //mxd. Check if any selected thing is outside of map boundary - private static bool CanDrag() + private static bool CanDrag(ICollection dragthings) { - ICollection selectedthings = General.Map.Map.GetSelectedThings(true); int unaffectedCount = 0; - foreach(Thing t in selectedthings) + foreach(Thing t in dragthings) { // Make sure the vertex is inside the map boundary if(t.Position.x < General.Map.Config.LeftBoundary || t.Position.x > General.Map.Config.RightBoundary || t.Position.y > General.Map.Config.TopBoundary || t.Position.y < General.Map.Config.BottomBoundary) { - t.Selected = false; unaffectedCount++; } } - if(unaffectedCount == selectedthings.Count) + if (unaffectedCount == dragthings.Count) { - General.Interface.DisplayStatus(StatusType.Warning, "Unable to drag selection: " + (selectedthings.Count == 1 ? "selected thing is" : "all of selected things are") + " outside of map boundary!"); + General.Interface.DisplayStatus(StatusType.Warning, "Unable to drag selection: " + (dragthings.Count == 1 ? "selected thing is" : "all of selected things are") + " outside of map boundary!"); General.Interface.RedrawDisplay(); return false; } - if(unaffectedCount > 0) + if (unaffectedCount > 0) + { General.Interface.DisplayStatus(StatusType.Warning, unaffectedCount + " of selected vertices " + (unaffectedCount == 1 ? "is" : "are") + " outside of map boundary!"); + return false; + } return true; } diff --git a/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs b/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs index 2accf6b9..b25ae893 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs @@ -653,39 +653,39 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Start dragging the selection - if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag()) //mxd + if(!BuilderPlug.Me.DontMoveGeometryOutsideMapBoundary || CanDrag(dragvertices)) //mxd General.Editing.ChangeMode(new DragVerticesMode(mousedownmappos, dragvertices)); } } } //mxd. Check if any selected vertex is outside of map boundary - private static bool CanDrag() + private static bool CanDrag(ICollection dragvertices) { - ICollection selectedverts = General.Map.Map.GetSelectedVertices(true); int unaffectedCount = 0; - foreach(Vertex v in selectedverts) + foreach(Vertex v in dragvertices) { // Make sure the vertex is inside the map boundary if(v.Position.x < General.Map.Config.LeftBoundary || v.Position.x > General.Map.Config.RightBoundary || v.Position.y > General.Map.Config.TopBoundary || v.Position.y < General.Map.Config.BottomBoundary) { - - v.Selected = false; unaffectedCount++; } } - if(unaffectedCount == selectedverts.Count) + if (unaffectedCount == dragvertices.Count) { - General.Interface.DisplayStatus(StatusType.Warning, "Unable to drag selection: " + (selectedverts.Count == 1 ? "selected vertex is" : "all of selected vertices are") + " outside of map boundary!"); + General.Interface.DisplayStatus(StatusType.Warning, "Unable to drag selection: " + (dragvertices.Count == 1 ? "selected vertex is" : "all of selected vertices are") + " outside of map boundary!"); General.Interface.RedrawDisplay(); return false; } - - if(unaffectedCount > 0) + + if (unaffectedCount > 0) + { General.Interface.DisplayStatus(StatusType.Warning, unaffectedCount + " of selected vertices " + (unaffectedCount == 1 ? "is" : "are") + " outside of map boundary!"); + return false; + } return true; }