private void Form1_MouseUp(object sender, MouseEventArgs e)
{
if (cycle == true)
{
goto run6;
}
g = CreateGraphics();
click = e.Location;
switch (e.Button)
{
case MouseButtons.Left:
Vertex v = new Vertex();
v.Center = click;
v.hitbox = v.Hitbox(click);
List<Point> a = v.Area(click);
foreach (Point o in areas)
{
foreach (Point n in a)
{
if (o == n)
{
goto run1;
}
}
}
areas.AddRange(a.ToArray());
v.id = vertices.Count;
vertices.Add(v);
DrawVertex(v);
run1:
break;
case MouseButtons.Right:
foreach (Vertex ver in vertices)
{
if (ver.hitbox.Contains(click))
{
if (ed.start == null)
break;
if (ver == ed.start)
break;
ed.end = ver;
Edge tmp = new Edge();
tmp.start = ed.start;
tmp.end = ver;
foreach (Edge s in edges)
{
if (tmp.start == s.start && tmp.end == s.end)
goto run2;
if (ed.start == s.end && ed.end == s.start)
goto run2;
}
tmp.middle = tmp.Middle(tmp.start.Center, tmp.end.Center);
edges.Add(tmp);
g.DrawLine(stroke, ed.start.Center, ed.end.Center);
DrawVertex(ed.start);
DrawVertex(ed.end);
run2:
break;
}
}
break;
}
run6:
bool b;
}