Browse Source

Final touches before merge.

- Removed unneccessary code
Martin Edlund 5 years ago
parent
commit
fdc8b4626a

+ 1 - 322
SketchAssistant/SketchAssistant.Tests/UnitTest1.cs

@@ -271,326 +271,5 @@ namespace Tests
             Assert.AreEqual(message, lastActionLabel);
         }
     }
-
-    /*
-    [TestClass]
-    public class FileImporterTests
-    {
-        [DataTestMethod]
-        [DataRow(new int[] { 54, 43, 57, 11, 145, 34, 113, 299, 0 }, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 })]
-        [DataRow(new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 })]
-        [DataRow(new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, new int[] { 54, 43, 57, 11, 145, 34, 113, 199, 0 })]
-        public void ParseISADInputSuccessfulTest(int[] xCoordinates, int[] yCoordinates)
-        {
-            Form1 program = new Form1();
-            FileImporter uut = new SketchAssistant.FileImporter();
-
-            List<String> file = new List<string>();
-            file.Add("drawing");
-            file.Add("300x200");
-            for (int i = 0; i < xCoordinates.Length - 2; i += 3)
-            {
-                file.Add("line");
-                file.Add(xCoordinates[i] + ";" + yCoordinates[i]);
-                file.Add(xCoordinates[i + 1] + ";" + yCoordinates[i + 1]);
-                file.Add(xCoordinates[i + 2] + ";" + yCoordinates[i + 2]);
-                file.Add("endline");
-            }
-            file.Add("enddrawing");
-
-            (int, int, List<Line>) values = uut.ParseISADInputForTesting(file.ToArray());
-            program.CreateCanvasAndSetPictureForTesting(values.Item1, values.Item2, values.Item3);
-
-            Line[] drawing = GetLeftImage(program).ToArray();
-
-            Assert.AreEqual(xCoordinates.Length / 3, drawing.Length);
-            for (int i = 0; i < xCoordinates.Length - 2; i += 3)
-            {
-                Point[] currentLine = drawing[i / 3].GetPoints().ToArray();
-                Assert.AreEqual(3, currentLine.Length);
-                for (int j = 0; j < 3; j++)
-                {
-                    Assert.IsTrue(currentLine[j].X == xCoordinates[i + j] && currentLine[j].Y == yCoordinates[i + j]);
-                }
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(new String[] {})]
-        [DataRow(new String[] { "begindrawing", "300x300", "line", "50;50", "100;50", "endline", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "300;300", "line", "50;50", "100;50", "endline", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "30.5x300", "line", "50;50", "100;50", "endline", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "line", "50;50", "100;50", "endline", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "300x300", "beginline", "50;50", "100;50", "endline", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "300x300", "line", "500;50", "100;50", "endline", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "300x300", "line", "50x50", "100;50", "endline", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "300x300", "line", "50", "100", "endline", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "300x300", "line", "50;50", "line", "endline", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "300x300", "line", "50;50", "100;50", "stopline", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "300x300", "line", "50;50", "100;50", "enddrawing" })]
-        [DataRow(new String[] { "drawing", "300x300", "line", "50;50", "100;50", "endline", "endrawing" })]
-        [DataRow(new String[] { "drawing", "300x300", "line", "50;50", "100;50", "endline" })]
-        public void ParseISADInputExceptionTest(String[] file)
-        {
-            bool exceptionThrown = false;
-            Form1 program = new Form1();
-            FileImporter uut = new SketchAssistant.FileImporter(program);
-            //check that left image initially is uninitialized
-            Assert.IsNull(GetLeftImage(program));
-            //initialize left image with a valid isad drawing
-            (int, int, List<Line>) values = uut.ParseISADInputForTesting(new string[] { "drawing", "300x205", "line", "40;40", "140;140", "endline", "enddrawing" });
-            program.CreateCanvasAndSetPictureForTesting(values.Item1, values.Item2, values.Item3);
-            //save left image for later comparison
-            List<Line> oldLeftImage = GetLeftImage(program);
-            try
-            {
-                //try to initialize the left image with an invalid isad drawing
-                (int, int, List<Line>) values1 = uut.ParseISADInputForTesting(file);
-                program.CreateCanvasAndSetPictureForTesting(values1.Item1, values1.Item2, values1.Item3);
-            }
-            catch(FileImporterException)
-            {
-                //save the occurence of an exception
-                exceptionThrown = true;
-            }
-            //check that an exception has been thrown
-            Assert.IsTrue(exceptionThrown);
-            //check that the left image has not been changed by the failed image import
-            Assert.AreEqual(oldLeftImage, GetLeftImage(program));
-        }
-
-        /// <summary>
-        /// local helper method retrieving the left image from a Form1 instance
-        /// </summary>
-        /// <returns>the left image of the given Form1 instance</returns>
-        private List<Line> GetLeftImage(Form1 program)
-        {
-            //cast is save as long as Form1#GetAllVariables() is conform to its contract
-            return (List<Line>)program.GetAllVariables().Find(x => x.Item1.Equals("leftLineList")).Item2;
-        }
-    }*/
-
-    /*
-    [TestClass]
-    public class RedrawAssistantTests
-    {
-        private RedrawAssistant GetAssistant(List<Line> input)
-        {
-            if(input.Count == 0)
-            {
-                return new RedrawAssistant();
-            }
-            else
-            {
-                return new RedrawAssistant(input);
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(17, 20, new int[] { 54, 43, 57, 11, 145, 34, 113, 299, 0 }, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, true)]
-        [DataRow(-50, 30, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, false)]
-        [DataRow(-70, -20, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, new int[] { 54, 43, 57, 11, 145, 34, 113, 199, 0 }, true)]
-        public void InactiveRedrawAssistantTest(int x, int y, int[] xCoords, int[] yCoords, bool lineActive)
-        {
-            RedrawAssistant testAssistant = GetAssistant(new List<Line>());
-            List<Point> testPoints = new List<Point>();
-            for (int i = 0; i < xCoords.Length; i++)
-            {
-                testPoints.Add(new Point(xCoords[i], yCoords[i]));
-            }
-            List<Tuple<bool, Line>> testLines = new List<Tuple<bool, Line>> { new Tuple<bool, Line>(lineActive, new Line(testPoints, 0)) };
-            List<HashSet<Point>> result = testAssistant.Tick(new Point(1, 1), testLines, -1, false);
-            Assert.AreEqual(0, result.Count);
-        }
-
-        [DataTestMethod]
-        [DataRow(17, 20, new int[] { 54, 43, 57, 11, 145, 34, 113, 299, 0 }, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, 1)]
-        [DataRow(-50, 30, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, 1)]
-        [DataRow(33, 54, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, new int[] { 54, 43, 57, 11, 145, 34, 113, 199, 0 }, 2)]
-        public void ActiveRedrawAssistantTestStartedDrawing(int x, int y, int[] xCoords, int[] yCoords, int resultingCount)
-        {
-            List<Point> testPoints = new List<Point>();
-            for (int i = 0; i < xCoords.Length; i++)
-            {
-                testPoints.Add(new Point(xCoords[i], yCoords[i]));
-            }
-            List<Tuple<bool, Line>> testInputLines = new List<Tuple<bool, Line>>();
-            List<Line> testRedrawLines = new List<Line> { new Line(testPoints, 0) };
-            RedrawAssistant testAssistant = GetAssistant(testRedrawLines);
-            //Setting Marker Radius to 1 so that only the functionality of the RedrawAssistant is checked 
-            //and not the functionality of the Circle algorithm.
-            testAssistant.SetMarkerRadius(1);
-            List<HashSet<Point>> tickResult = testAssistant.Tick(new Point(x, y), testInputLines, -1, false);
-
-
-            Assert.AreEqual(resultingCount, tickResult.Count);
-            if(resultingCount == 1)
-            {
-                foreach(Point p in tickResult[0])
-                {
-                    Assert.AreEqual(testPoints[0], p);
-                }
-            }
-            if(resultingCount == 2)
-            {
-                foreach (Point p in tickResult[0])
-                {
-                    Assert.AreEqual(testPoints[0], p);
-                }
-                foreach (Point p in tickResult[1])
-                {
-                    Assert.AreEqual(testPoints[testPoints.Count-1], p);
-                }
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(17, 20, new int[] { 54, 43, 57, 11, 145, 34, 113, 299, 0 }, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 },
-             new int[] { 77, 20, 3, 74, 28 }, new int[] { 40, 50, 20, 77, 28}, 2, false)]
-        [DataRow(33, 33, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 },
-             new int[] { 42, 140, 30, 30, 30 }, new int[] { 11, 145, 34, 113, 28 }, 2, true)]
-        [DataRow(33, 54, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, new int[] { 54, 43, 57, 11, 145, 34, 113, 199, 0 },
-             new int[] { 43, 57, 11, 145 }, new int[] { 33, 42, 140, 30 }, 2, true)]
-        public void ActiveRedrawAssistantTestMultipleLinesRedrawn(
-            int x, int y, int[] xCoords_one, int[] yCoords_one, int[] xCoords_two, int[] yCoords_two, int resultingCount, bool showingStartAndEnd)
-        {
-            List<Point> testPoints1 = new List<Point>();
-            for (int i = 0; i < xCoords_one.Length; i++)
-            {
-                testPoints1.Add(new Point(xCoords_one[i], yCoords_one[i]));
-            }
-            List<Point> testPoints2 = new List<Point>();
-            for (int i = 0; i < xCoords_two.Length; i++)
-            {
-                testPoints2.Add(new Point(xCoords_two[i], yCoords_two[i]));
-            }
-            List<Tuple<bool, Line>> testInputLines = new List<Tuple<bool, Line>>();
-
-            List<Line> testRedrawLines = new List<Line> { new Line(testPoints1, 0) , new Line(testPoints2, 1) };
-            RedrawAssistant testAssistant = GetAssistant(testRedrawLines);
-            //Setting Marker Radius to 1 so that only the functionality of the RedrawAssistant is checked 
-            //and not the functionality of the Circle algorithm.
-            testAssistant.SetMarkerRadius(1);
-
-            List<HashSet<Point>> tickResult = testAssistant.Tick(new Point(x, y), testInputLines, -1, false);
-
-            Assert.AreEqual(resultingCount, tickResult.Count);
-            if (showingStartAndEnd)
-            {
-                foreach (Point p in tickResult[0])
-                {
-                    Assert.AreEqual(testPoints1[0], p);
-                }
-                foreach (Point p in tickResult[1])
-                {
-                    Assert.AreEqual(testPoints1[testPoints1.Count - 1], p);
-                }
-            }
-            else
-            {
-                foreach (Point p in tickResult[0])
-                {
-                    Assert.AreEqual(testPoints1[0], p);
-                }
-                foreach (Point p in tickResult[1])
-                {
-                    Assert.AreEqual(testPoints2[0], p);
-                }
-            }
-        }
-
-        [DataTestMethod]
-        [DataRow(17, 20, 17, 20, -1 ,false, new int[] { 54, 43, 57, 11, 145, 34, 113, 299, 0 }, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 },
-     new int[] { 77, 20, 3, 74, 28 }, new int[] { 40, 50, 20, 77, 28 }, 2, 2, false, false)]
-
-        [DataRow(33, 33, 2, 2, 0, true, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 },
-     new int[] { 42, 140, 30, 30, 30 }, new int[] { 11, 145, 34, 113, 28 }, 2, 1, true, false)]
-
-        [DataRow(33, 54, 17, 0, 0, true, new int[] { 33, 42, 140, 30, 30, 30, 32, 145, 2 }, new int[] { 54, 43, 57, 11, 145, 34, 113, 199, 0 },
-     new int[] { 43, 57, 11, 145 }, new int[] { 33, 42, 140, 30 }, 2, 2, true, false)]
-        public void ActiveRedrawAssistantTestLineFinished(
-            int x_one, int y_one, int x_two, int y_two, int lineID, bool finishedDrawing, int[] xCoords_one, int[] yCoords_one, int[] xCoords_two, int[] yCoords_two, 
-            int count_one, int count_two, bool showingSE_one, bool showingSE_two)
-        {
-            List<Point> testPoints1 = new List<Point>();
-            for (int i = 0; i < xCoords_one.Length; i++)
-            {
-                testPoints1.Add(new Point(xCoords_one[i], yCoords_one[i]));
-            }
-            List<Point> testPoints2 = new List<Point>();
-            for (int i = 0; i < xCoords_two.Length; i++)
-            {
-                testPoints2.Add(new Point(xCoords_two[i], yCoords_two[i]));
-            }
-            List<Tuple<bool, Line>> testInputLines = new List<Tuple<bool, Line>>();
-
-            List<Line> testRedrawLines = new List<Line> { new Line(testPoints1, 0), new Line(testPoints2, 1) };
-            RedrawAssistant testAssistant = GetAssistant(testRedrawLines);
-            //Setting Marker Radius to 1 so that only the functionality of the RedrawAssistant is checked 
-            //and not the functionality of the Circle algorithm.
-            testAssistant.SetMarkerRadius(1);
-
-            List<HashSet<Point>> tickResult1 = testAssistant.Tick(new Point(x_one, y_one), testInputLines, lineID, false);
-            List<HashSet<Point>> tickResult2 = testAssistant.Tick(new Point(x_two, y_two), testInputLines, lineID, finishedDrawing);
-
-            Assert.AreEqual(count_one, tickResult1.Count);
-            if (showingSE_one)
-            {
-                foreach(Point p in tickResult1[0])
-                {
-                    Assert.AreEqual(testPoints1[0], p);
-                }
-                foreach (Point p in tickResult1[1])
-                {
-                    Assert.AreEqual(testPoints1[testPoints1.Count - 1], p);
-                }
-            }
-            else
-            {
-                foreach (Point p in tickResult1[0])
-                {
-                    Assert.AreEqual(testPoints1[0], p);
-                }
-                foreach (Point p in tickResult1[1])
-                {
-                    Assert.AreEqual(testPoints2[0], p);
-                }
-            }
-
-            Assert.AreEqual(count_two, tickResult2.Count);
-            if(count_two == 2)
-            {
-                if (showingSE_two)
-                {
-                    foreach (Point p in tickResult2[0])
-                    {
-                        Assert.AreEqual(testPoints1[0], p);
-                    }
-                    foreach (Point p in tickResult2[1])
-                    {
-                        Assert.AreEqual(testPoints1[testPoints1.Count - 1], p);
-                    }
-                }
-                else
-                {
-                    foreach (Point p in tickResult2[0])
-                    {
-                        Assert.AreEqual(testPoints1[0], p);
-                    }
-                    foreach (Point p in tickResult2[1])
-                    {
-                        Assert.AreEqual(testPoints2[0], p);
-                    }
-                }
-            }
-            if(count_two == 1)
-            {
-                foreach (Point p in tickResult2[0])
-                {
-                    Assert.AreEqual(testPoints2[0], p);
-                }
-            }
-        }
-    }
-    */
+    
 }

+ 6 - 0
SketchAssistant/SketchAssistant.sln

@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SketchAssistant", "SketchAs
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SketchAssistant.Tests", "SketchAssistant.Tests\SketchAssistant.Tests.csproj", "{7DCDC31A-8291-4B05-93D6-DCC5DE27A4A0}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SketchAssistantWPF", "SketchAssistantWPF\SketchAssistantWPF.csproj", "{A7673CB5-CAAA-4BF1-BAA9-06A8DB0428D7}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
 		{7DCDC31A-8291-4B05-93D6-DCC5DE27A4A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{7DCDC31A-8291-4B05-93D6-DCC5DE27A4A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{7DCDC31A-8291-4B05-93D6-DCC5DE27A4A0}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A7673CB5-CAAA-4BF1-BAA9-06A8DB0428D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A7673CB5-CAAA-4BF1-BAA9-06A8DB0428D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A7673CB5-CAAA-4BF1-BAA9-06A8DB0428D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A7673CB5-CAAA-4BF1-BAA9-06A8DB0428D7}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 3 - 2
SketchAssistant/SketchAssistant/Form1.Designer.cs

@@ -86,6 +86,7 @@ namespace SketchAssistant
             this.pictureBoxRight.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.pictureBoxRight.TabIndex = 6;
             this.pictureBoxRight.TabStop = false;
+            this.pictureBoxRight.Click += new System.EventHandler(this.pictureBoxRight_Click);
             this.pictureBoxRight.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBoxRight_MouseDown);
             this.pictureBoxRight.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBoxRight_MouseMove);
             this.pictureBoxRight.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBoxRight_MouseUp);
@@ -126,13 +127,13 @@ namespace SketchAssistant
             this.importToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.examplePictureToolStripMenuItem});
             this.importToolStripMenuItem.Name = "importToolStripMenuItem";
-            this.importToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+            this.importToolStripMenuItem.Size = new System.Drawing.Size(119, 22);
             this.importToolStripMenuItem.Text = "Import...";
             // 
             // examplePictureToolStripMenuItem
             // 
             this.examplePictureToolStripMenuItem.Name = "examplePictureToolStripMenuItem";
-            this.examplePictureToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+            this.examplePictureToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
             this.examplePictureToolStripMenuItem.Text = "Example picture";
             this.examplePictureToolStripMenuItem.Click += new System.EventHandler(this.examplePictureToolStripMenuItem_Click);
             // 

+ 10 - 41
SketchAssistant/SketchAssistant/Form1.cs

@@ -135,6 +135,14 @@ namespace SketchAssistant
             }
         }
 
+        /// <summary>
+        /// The Picture box is clicked.
+        /// </summary>
+        private void pictureBoxRight_Click(object sender, EventArgs e)
+        {
+            ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Click);
+        }
+
         /// <summary>
         /// Get current Mouse positon within the right picture box.
         /// </summary>
@@ -148,7 +156,7 @@ namespace SketchAssistant
         /// </summary>
         private void pictureBoxRight_MouseDown(object sender, MouseEventArgs e)
         {
-            ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Down, e);
+            ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Down);
         }
         
         /// <summary>
@@ -156,7 +164,7 @@ namespace SketchAssistant
         /// </summary>
         private void pictureBoxRight_MouseUp(object sender, MouseEventArgs e)
         {
-            ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Up, e);
+            ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Up);
         }
         
         /// <summary>
@@ -311,44 +319,5 @@ namespace SketchAssistant
             return (MessageBox.Show(message, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes);
         }
 
-        /********************************************/
-        /*** TESTING RELATED FUNCTIONS START HERE ***/
-        /********************************************/
-
-        /*
-
-        /// <summary>
-        /// returns all instance variables in the order of their definition for testing
-        /// </summary>
-        /// <returns>A list of tuples containing names of variables and the variable themselves. 
-        /// Cast according to the Type definitions in the class variable section.</returns>
-        public List<Tuple<String, Object>>GetAllVariables()
-        {
-            var objArr = new (String, object)[] { ("currentState", currentState), ("fileImporter", fileImporter), ("openFileDialog", openFileDialog),
-                ("leftImage", leftImage), ("leftLineList", leftLineList), ("rightImage", rightImage), ("currentLine", currentLine),
-                ("rightLineList", rightLineList), ("mousePressed", mousePressed), ("currentCursorPosition", currentCursorPosition),
-                ("previousCursorPosition", previousCursorPosition), ("cursorPositions", cursorPositions), ("rightGraph", rightGraph),
-                ("isFilledMatrix", isFilledMatrix), ("linesMatrix", linesMatrix), ("deletionRadius", deletionRadius),
-                ("historyOfActions", historyOfActions), ("overlayItems", overlayItems), ("redrawAss", redrawAss), ("markerRadius", markerRadius) };
-            var varArr = new List<Tuple<String, Object>>();
-            foreach((String, object) obj in objArr)
-            {
-                varArr.Add(new Tuple<string, object>(obj.Item1, obj.Item2));
-            }
-            return varArr;
-        }
-
-        /// <summary>
-        /// public method wrapper for testing purposes, invoking DrawEmptyCanvas(...) and BindAndDrawLeftImage(...)
-        /// </summary>
-        /// <param name="width">width of the parsed image</param>
-        /// <param name="height">height of the parsed image</param>
-        /// <param name="newImage">the parsed image</param>
-        public void CreateCanvasAndSetPictureForTesting(int width, int height, List<Line> newImage)
-        {
-            DrawEmptyCanvasLeft(width, height);
-            BindAndDrawLeftImage(newImage);
-        }
-        */
     }
 }

+ 22 - 3
SketchAssistant/SketchAssistant/MVP_Presenter.cs

@@ -143,15 +143,35 @@ namespace SketchAssistant
         }
 
         /// <summary>
-        /// Pass-trough function that calls the correct Mouse event of the model.
+        /// Pass-trough when the mouse is moved.
         /// </summary>
         /// <param name="mouseAction">The action which is sent by the View.</param>
         /// <param name="e">The Mouse event arguments.</param>
         public void MouseEvent(MouseAction mouseAction, MouseEventArgs e)
+        {
+            switch (mouseAction)
+            {
+                case MouseAction.Move:
+                    programModel.SetCurrentCursorPosition(ConvertCoordinates(new Point(e.X, e.Y)));
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        /// <summary>
+        /// Pass-trough function that calls the correct Mouse event of the model, when the mouse is clicked.
+        /// </summary>
+        /// <param name="mouseAction">The action which is sent by the View.</param>
+        /// <param name="e">The Mouse event arguments.</param>
+        public void MouseEvent(MouseAction mouseAction)
         {
             switch (mouseAction)
             {
                 case MouseAction.Click:
+                    programModel.MouseDown();
+                    programModel.Tick();
+                    programModel.MouseUp();
                     break;
                 case MouseAction.Down:
                     programModel.MouseDown();
@@ -159,8 +179,7 @@ namespace SketchAssistant
                 case MouseAction.Up:
                     programModel.MouseUp();
                     break;
-                case MouseAction.Move:
-                    programModel.SetCurrentCursorPosition(ConvertCoordinates(new Point(e.X, e.Y)));
+                default:
                     break;
             }
         }