public override void DoMouseMove() { if (myLink != null && myLink.ToPort != null) { GoPort p = myLink.ToPort.GoObject as GoPort; if (p != null) { p.Position = this.LastInput.DocPoint; FlowBlock gn = this.View.PickObject(true, false, this.LastInput.DocPoint, true) as FlowBlock; if (gn != null && gn != this.Predecessor && !FlowView.IsLinked(this.Predecessor, gn)) { GoPort nearest = FindNearestPort(this.LastInput.DocPoint, gn); if (nearest != null) { p.Position = nearest.Position; p.ToSpot = nearest.ToSpot; } } } } }
public override void DoMouseDown() { if (this.Predecessor == null) { FlowBlock gn = this.View.PickObject(true, false, this.LastInput.DocPoint, true) as FlowBlock; if (gn == null) { return; } if (!gn.IsPredecessor) { return; } this.Predecessor = gn; MainBase.App.SetStatusMessage("From block " + this.Predecessor.Text); MakeTemporaryLink(); } else { FlowBlock gn = this.View.PickObject(true, false, this.LastInput.DocPoint, true) as FlowBlock; if (gn != null && gn != this.Predecessor && !FlowView.IsLinked(this.Predecessor, gn)) { // delete the temporary link this.View.Layers.Default.Remove(myLink); myLink = null; // create the link in the design GoPort nearest = FindNearestPort(this.LastInput.DocPoint, gn); IGoLink link = this.View.CreateLink(this.Predecessor.BottomPort, nearest); if (link != null) { this.TransactionResult = "New link"; this.View.RaiseLinkCreated(link.GoObject); this.View.Selection.Select(link.GoObject); } StopTool(); } } }