private void SimpleShape_MouseDown(object sender, MouseButtonEventArgs e) { log.Debug("DiagramShape MouseDown"); log.DebugFormat("Shape has {0} ConnectionPoints", ((DiagramShape)e.Source).ConnectionPoints.Count()); if (e.ButtonState == MouseButtonState.Released) { return; } if (e.ChangedButton == MouseButton.Left) // Drag and Drop { var simpleShape = e.Source as DiagramShape; Point startPoint = e.GetPosition(Surface); _Dragger = new SimpleShapeDragger(Surface, this, startPoint, simpleShape); Surface.SelectedShape = simpleShape; e.Handled = true; } // Select shape and create a new connection else if (e.ChangedButton == MouseButton.Middle) { if (Surface.SelectedShape == null) { Surface.SelectedShape = sender as DiagramShape; } else { var targetShape = (DiagramShape)sender; if (targetShape == Surface.SelectedShape) { Surface.SelectedShape = null; return; } // Not allowing creation of connections in the diagrammer yet. //if(Surface.Controller.CanConnect(Surface.SelectedShape, targetShape) == false) //{ // Surface.AddConnection(Surface.SelectedShape, targetShape); // Surface.SelectedShape = null; //} } e.Handled = true; } }
public void DragFinished() { _Dragger = null; }