public override void ProcessInteraction(DiagramInteractionEventArguments interaction) { if (interaction.Type == InteractionType.KeyUp) { _shouldStopInteraction = true; } }
public override void ProcessInteraction(DiagramInteractionEventArguments interaction) { if (interaction.ViewModelUnderMouse is Wire wire) { wire.DisconnectWire(); interaction.Diagram.RemoveWire(wire); } }
/// <summary> /// Adds a node to the diagram interactively, allowing the user to move the mouse and click to choose the final position for the node. /// </summary> /// <param name="node">The node to add.</param> public void AddNodeInteractively(Node node) { AddNode(node); var interaction = new DiagramInteractionEventArguments(InteractionType.NodeInserted); DiagramInteractionManager.HandleDiagramInput(interaction, this); }
/// <inheritdoc/> public override bool ShouldStartInteraction(DiagramInteractionEventArguments interaction) { return(interaction.Type == InteractionType.KeyDown && !interaction.IsAltKeyPressed && !interaction.IsShiftKeyPressed && interaction.IsCtrlKeyPressed && interaction.Key == System.Windows.Input.Key.Left); }
private void KeyInputHandler(KeyEventArgs e, InteractionType type) { var interaction = new DiagramInteractionEventArguments(type) { Key = e.Key }; DiagramInteractionManager.HandleDiagramInput(interaction, this); }
private void KeyInputHandler(IInputElement sender, KeyEventArgs e, InteractionType type) { var mousePosition = Mouse.GetPosition(sender); var interaction = new DiagramInteractionEventArguments(type) { MousePosition = mousePosition, Key = e.Key }; DiagramInteractionManager.HandleDiagramInput(interaction, this); }
public override void StartInteraction(DiagramInteractionEventArguments interaction) { if (interaction.ViewModelUnderMouse is IMouseEnterLeaveReaction reaction) { if (reaction != ReactionMouseIsCurrentlyIn) { ReactionMouseIsCurrentlyIn?.MouseLeft(); ReactionMouseIsCurrentlyIn = reaction; ReactionMouseIsCurrentlyIn.MouseEntered(); } } }
public void AddNode(Node node) { if (node.Model == null) { throw new InvalidOperationException("Can not add a node to the diagram before it has been initialized"); } Model.AddNode(node.Model); AddNodeViewModel(node); var interaction = new DiagramInteractionEventArguments(InteractionType.NodeInserted); DiagramInteractionManager.HandleDiagramInput(interaction, this); }
private void MouseInputHandler(object sender, MouseEventArgs e, InteractionType interactionType) { var relativeMousePosition = e.GetPosition((IInputElement)sender); var interaction = new DiagramInteractionEventArguments(interactionType) { MousePosition = relativeMousePosition }; if (e is MouseWheelEventArgs mouseWheelEventArguments) { interaction.MouseWheelDelta = mouseWheelEventArguments.Delta; } DiagramInteractionManager.HandleDiagramInput(interaction, this); }
public override void ProcessInteraction(DiagramInteractionEventArguments interaction) { var diagram = interaction.Diagram; var mousePosition = interaction.MousePosition; var diagramStartX = diagram.GetDiagramPointFromViewPointX(mousePosition.X); var diagramStartY = diagram.GetDiagramPointFromViewPointY(mousePosition.Y); var zoom = interaction.MouseWheelDelta > 0 ? 1.0 + ZoomAmount : 1.0 - ZoomAmount; var newZoom = diagram.Zoom * zoom; SetZoom(diagram, newZoom); var diagramEndX = diagram.GetDiagramPointFromViewPointX(mousePosition.X); var diagramEndY = diagram.GetDiagramPointFromViewPointY(mousePosition.Y); diagram.PanX -= diagramStartX - diagramEndX; diagram.PanY -= diagramStartY - diagramEndY; }
/// <inheritdoc/> public override void ProcessInteraction(DiagramInteractionEventArguments interaction) { }
public override void StartInteraction(DiagramInteractionEventArguments interaction) { X = (interaction.Diagram.ViewWidth / 2) - 250; Y = (interaction.Diagram.ViewHeight / 2) - 200; _shouldStopInteraction = false; }
public override bool ShouldStartInteraction(DiagramInteractionEventArguments interaction) { return(interaction.Type == InteractionType.KeyDown && interaction.Key == System.Windows.Input.Key.Oem2); }
/// <inheritdoc/> public override void ProcessInteraction(DiagramInteractionEventArguments interaction) { interaction.Diagram.RequestClose(); }
/// <inheritdoc/> public override bool ShouldStopInteraction(DiagramInteractionEventArguments interaction) { return(true); }
/// <inheritdoc/> public override bool ShouldStopInteraction(DiagramInteractionEventArguments interaction) { return(interaction.Type == InteractionType.MouseMoved); }
/// <inheritdoc/> public override void StopInteraction(DiagramInteractionEventArguments interaction) { }
public override bool ShouldStartInteraction(DiagramInteractionEventArguments interaction) { return(interaction.Type == InteractionType.LeftMouseDown && interaction.IsCtrlKeyPressed && interaction.ViewModelUnderMouse is Wire wire); }