Esempio n. 1
0
 public void Select(DraggableGridSnapper control)
 {
     if (selected != null)
     {
         selected.Deselect();
     }
     selected = control;
     selected.Select();
     dragging = control;
 }
Esempio n. 2
0
        private void Window_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Delete)
            {
                if (selected != null)
                {
                    if (selected is PatrolPoint)
                    {
                        (selected as PatrolPoint).Delete();
                    }

                    floorLayer.Remove(selected);
                    wallLayer.Remove(selected);
                    stuffLayer.Remove(selected);
                    lightsLayer.Remove(selected);
                    canvasRoom.Children.Remove(selected);
                    selected.SafeDelete();
                    selected = null;
                }
            }
            if (e.Key == Key.R)
            {
                if (selected != null)
                {
                    (selected.RenderTransform as RotateTransform).Angle += 90.0;
                    if (selected.snapMode == DraggableGridSnapper.SnapMode.HorizontalLineSnap)
                    {
                        selected.snapMode = DraggableGridSnapper.SnapMode.VerticalLineSnap;
                    }
                    else if (selected.snapMode == DraggableGridSnapper.SnapMode.VerticalLineSnap)
                    {
                        selected.snapMode = DraggableGridSnapper.SnapMode.HorizontalLineSnap;
                    }
                    selected.SnapToGrid();
                }
            }
            if (e.Key == Key.W)
            {
                if (selected != null)
                {
                    DraggableGridSnapper d = selected.Clone(this);
                    if (d != null && selected != null)
                    {
                        selected.Deselect();
                        selected = d;
                        d.Select();
                        d.SnapToGrid();
                    }
                }
            }
        }