public void Finished(object sender, InputModeEventArgs e) { if (editingContext != null) { editingContext.DragFinished(); editingContext = null; } }
public void Canceled(object sender, InputModeEventArgs e) { if (editingContext != null) { editingContext.CancelDrag(); editingContext = null; } }
public void Starting(object sender, InputModeEventArgs e) { IInputModeContext context = e.Context; var edgeEditingContext = context.Lookup <OrthogonalEdgeEditingContext>(); if (edgeEditingContext != null && !edgeEditingContext.IsInitializing && !edgeEditingContext.IsInitialized) { editingContext = edgeEditingContext; editingContext.InitializeDrag(context); } else { editingContext = null; } }
public virtual void InitializeReshape(IInputModeContext context) { this.OriginalBounds = rectangle.TightRectangle; // register our CollectSnapResults callback var snapContext = context.Lookup <GraphSnapContext>(); if (snapContext != null) { snapContext.CollectSnapResults += CollectSnapResults; } // store original node layouts, reshape handlers and reshape snap result providers foreach (var node in ReshapeNodes) { originalNodeLayouts.Add(node, node.Layout.ToRectD()); // store reshape handler to change the shape of node var reshapeHandler = node.Lookup <IReshapeHandler>(); if (reshapeHandler != null) { reshapeHandler.InitializeReshape(context); reshapeHandlers.Add(node, reshapeHandler); } // store reshape snap result provider to collect snap results where node would snap to snaplines etc. var snapResultProvider = node.Lookup <INodeReshapeSnapResultProvider>(); if (snapContext != null && snapResultProvider != null) { reshapeSnapResultProviders.Add(node, snapResultProvider); } // store orthogonal edge drag handler that keeps edges at node orthogonal var orthogonalEdgeDragHandler = OrthogonalEdgeEditingContext.CreateOrthogonalEdgeDragHandler(context, node, false); if (orthogonalEdgeDragHandler != null) { orthogonalEdgeDragHandlers[node] = orthogonalEdgeDragHandler; } } // update the minimum/maximum size of the handle considering all initial node layouts Handle.MinimumSize = CalculateMinimumSize(); Handle.MaximumSize = CalculateMaximumSize(); // start a compound undo unit this.compoundEdit = context.GetGraph().BeginEdit("Undo Group Resize", "Redo Group Resize"); }