Example #1
0
 static ViewportContextMenu()
 {
     Instance = new ViewportContextMenu();
 }
Example #2
0
 public override void OverrideViewportContextMenu(ViewportContextMenu menu, Viewport2D vp, ViewportEvent e)
 {
     menu.Items.Clear();
     if (State.Handle == ResizeHandle.Center)
     {
         var item = new ToolStripMenuItem("Create Object");
         item.Click += (sender, args) => BoxDrawnConfirm(vp);
         menu.Items.Add(item);
     }
 }
Example #3
0
 public virtual void OverrideViewportContextMenu(ViewportContextMenu menu, Viewport2D vp, ViewportEvent e)
 {
     // Default: nothing...
 }
Example #4
0
 static ViewportContextMenu()
 {
     Instance = new ViewportContextMenu();
 }
Example #5
0
 public override void OverrideViewportContextMenu(ViewportContextMenu menu, Viewport2D vp, ViewportEvent e)
 {
     menu.Items.Clear();
     var point = vp.ScreenToWorld(e.X, vp.Height - e.Y);
     var loc = vp.Flatten(_location);
     if ((loc-point).VectorMagnitude() < 10)
     {
         var item = new ToolStripMenuItem("Create Object");
         item.Click += (sender, args) => CreateEntity(_location);
         menu.Items.Add(item);
     }
 }
Example #6
0
        public override void OverrideViewportContextMenu(ViewportContextMenu menu, Viewport2D vp, ViewportEvent e)
        {
            menu.Items.Clear();
            if (_location == null) return;

            var gd = _sidebarPanel.GetSelectedEntity();
            if (gd != null)
            {
                var item = new ToolStripMenuItem("Create " + gd.Name);
                item.Click += (sender, args) => CreateEntity(_location);
                menu.Items.Add(item);
                menu.Items.Add(new ToolStripSeparator());
            }

            if (_menu != null)
            {
                menu.Items.AddRange(_menu);
            }
        }