Martin Edlund пре 5 година
родитељ
комит
9988b5b6e0
1 измењених фајлова са 4 додато и 10 уклоњено
  1. 4 10
      SketchAssistant/SketchAssistantWPF/InternalLine.cs

+ 4 - 10
SketchAssistant/SketchAssistantWPF/InternalLine.cs

@@ -117,16 +117,10 @@ namespace SketchAssistantWPF
         /// </summary>
         private void CleanPoints()
         {
-            if (linePoints.Count > 1)
+            if (linePoints.Any())
             {
-                //if this is a point or not
-                var localIsPoint = true;
                 //check if its a point
-                foreach(Point p in linePoints)
-                {
-                    if (p.X != linePoints[0].X || p.Y != linePoints[0].Y)
-                        localIsPoint = false;
-                }
+                var localIsPoint = linePoints.All(o => o.X == linePoints.First().X && o.Y == linePoints.First().Y);
                 if (!localIsPoint) {
                     List<Point> newList = new List<Point>();
                     List<Point> tempList = new List<Point>();
@@ -162,8 +156,8 @@ namespace SketchAssistantWPF
                 else
                 {
                     isPoint = true;
-                    point = linePoints[0];
-                    linePoints = new List<Point>();
+                    point = linePoints.First();
+                    linePoints.Clear();
                     linePoints.Add(point);
                 }
             }