Esempio n. 1
0
        private void PolygonRegionSurface_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (DrawableObjects.Cast <NodeObject>().Any(node => node.IsMouseHover || node.IsDragging))
                {
                    return;
                }

                if (nodes.Count == 0)
                {
                    CreateNode();
                }

                CreateNode();

                isAreaCreated = true;
            }
            else if (e.Button == MouseButtons.Right)
            {
                if (isAreaCreated)
                {
                    foreach (NodeObject node in nodes)
                    {
                        if (node.IsMouseHover)
                        {
                            nodes.Remove(node);
                            DrawableObjects.Remove(node);
                            return;
                        }
                    }

                    isAreaCreated = false;
                    nodes.Clear();
                    DrawableObjects.Clear();
                }
                else
                {
                    Close(SurfaceResult.Close);
                }
            }
        }
Esempio n. 2
0
 public void ClearObjects()
 {
     DrawableObjects.Clear();
 }