/// <inheritdoc/> public override void StartInteraction(DiagramInteractionEventArguments interaction) { PreviousMouseLocation = interaction.MousePosition; _resizingNodes = interaction.Diagram.Nodes.Where(n => n.IsSelected).ToArray(); _undoResizeCommand = new ResizeNodesToCurrentSizeCommand(_resizingNodes); _undoPositionAdjustmentCommand = new MoveNodesToCurrentPositionCommand(_resizingNodes); interaction.Diagram.ShowSnapGrid = true; }
/// <inheritdoc/> public override void StopInteraction(DiagramInteractionEventArguments interaction) { if (!interaction.IsCtrlKeyPressed) { foreach (var node in _resizingNodes) { node.X = interaction.Diagram.SnapToGrid(node.X); node.Y = interaction.Diagram.SnapToGrid(node.Y); node.Width = interaction.Diagram.SnapToGrid(node.Width); node.Height = interaction.Diagram.SnapToGrid(node.Height); } } interaction.Diagram.ShowSnapGrid = false; Mouse.SetCursor(Cursors.Arrow); var resizeCommand = new ResizeNodesToCurrentSizeCommand(_resizingNodes); var positionAdjustmentCommand = new MoveNodesToCurrentPositionCommand(_resizingNodes); _transactor.Transact(resizeCommand, _undoResizeCommand); _transactor.Transact(positionAdjustmentCommand, _undoPositionAdjustmentCommand); }