public Connection(Point point, ShapeBase shape, int node, int nodeNum) : this(point, shape, -1, node, nodeNum) { }
private void drawingSurface_MouseMove(object sender, MouseEventArgs e) {//перемещение мыши //текущая позиция pointDragged = e.GetPosition(drawingSurface); //флаги разрешенных действий if (isDragging) {//перемещение блока ((Block)selectedVisual).ChangeLocation(pointDragged + clickOffset, true); drawingSurface.InvalidateMeasure(); } else if (isConnectionDragging) {//частичное перемещение соединения draggingConnection.ChangeLocation(pointDragged); drawingSurface.InvalidateMeasure(); } else if ((isConnectionDraw) || (cmdConnection.IsChecked == true)) { //прорисовка соединения if (isConnectionDraw) { connectionLine.ChangeLocation(pointDragged, true); drawingSurface.InvalidateMeasure(); tempShape = drawingSurface.GetVisualCptMode(pointDragged) as ShapeBase; } else { tempShape = drawingSurface.GetVisual(pointDragged) as ShapeBase; } if (tempShape == null) { if (blockPortVisual != null) { blockPortVisual.Draw(false, false); blockPortVisual = null; } if ((connectingShape.TargetBlock != null) || (connectingShape.TargetConnection != null)) { ClearConnectionMode(); } return; } if (tempShape is Block) { if (blockPortVisual != null) { blockPortVisual.Draw(false, false); blockPortVisual = null; } tempBlock = tempShape as Block; tempShape = null; drawingSurface.SetVisualTopmost(tempBlock); blockPortVisual = tempBlock; tempBlock.Draw(false, true); //поиск порта tempPortNum = tempBlock.PortHitTest(pointDragged); if (tempPortNum != -1) {//порт найден connectingShape.TargetBlock = tempBlock; connectingShape.PortNum = tempPortNum; drawingSurface.Cursor = Cursors.Cross; } else { drawingSurface.Cursor = Cursors.Arrow; } tempBlock = null; } else if (tempShape is Connection) { connectingShape.TargetConnection = tempShape as Connection; connectingShape.Node = ((Connection)tempShape).GetNodeNum(pointDragged); } } e.Handled = true; }
public Connection(Point point, ShapeBase shape, int portNum) : this(point, shape, portNum, -1, -1) { }