protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); // if mouse button is not pressed we have no drag operation, ... if (e.LeftButton != MouseButtonState.Pressed) { this.dragStartPoint = null; } // but if mouse button is pressed and start point value is set we do have one if (this.dragStartPoint.HasValue) { // create connection adorner DesignerCanvas canvas = GetDesignerCanvas(this); if (canvas != null) { AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(canvas); if (adornerLayer != null) { ConnectorAdorner adorner = new ConnectorAdorner(canvas, this); if (adorner != null) { adornerLayer.Add(adorner); e.Handled = true; } } } } }
public void Draw() { AdornerLayer layer = AdornerLayer.GetAdornerLayer(ContainerCanvas); if (layer == null) { return; } System.Windows.Documents.Adorner adorner = new ModelOperationAdorner(this); if (adorners.FindIndex(item => item is ModelOperationAdorner) > -1) { return; } adorners.Add(adorner); layer.Add(adorner); System.Windows.Documents.Adorner adorner2 = new ConnectorAdorner(this); if (adorners.FindIndex(item => item is ConnectorAdorner) > -1) { return; } adorners.Add(adorner2); layer.Add(adorner2); #if DEBUG_ON // test value System.Console.WriteLine("{0} model refreshed", System.DateTime.Now.Millisecond); #endif }
public OverlayConnector([NotNull] OverlayCanvas overlayCanvas, Point start) { Assert.ArgumentNotNull(overlayCanvas, nameof(overlayCanvas)); OverlayCanvas = overlayCanvas; Start = start; End = start; adorner = new ConnectorAdorner(this, OverlayCanvas); adornerLayer = AdornerLayer.GetAdornerLayer(OverlayCanvas); adornerLayer.Add(adorner); }
private void OnMouseMove(object sender, MouseEventArgs e) { if (!this._isDrag || e.LeftButton != MouseButtonState.Pressed) { return; } var adornerLayer = AdornerLayer.GetAdornerLayer(this._designerCanvas); if (adornerLayer != null) { var connectorAdorner = new ConnectorAdorner(this._designerCanvas, this._connectorViewModel); adornerLayer.Add(connectorAdorner); e.Handled = true; } }
public void CreateConnectorAdorner() { if (ParentCanvas != null) { AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(ParentCanvas); if (adornerLayer != null) { CurrentAdorner = new ConnectorAdorner(ParentCanvas, BestExitConnector); if (CurrentAdorner != null) { adornerLayer.Add(CurrentAdorner); } } } }
protected virtual void OnMoveJack(MouseEventArgs e) { if (e.LeftButton != MouseButtonState.Pressed) { _startPointConnector = null; return; } var jack = VisualFinder.GetAncestor <Jack>((DependencyObject)e.OriginalSource); if (_startPointConnector.HasValue && jack != null) { var adornerLayer = AdornerLayer.GetAdornerLayer(ActivityCanvas.Instance); if (adornerLayer != null) { var adorner = new ConnectorAdorner(ActivityCanvas.Instance, _startPointConnector, jack, this); adornerLayer.Add(adorner); e.Handled = true; } } }