// コンストラクタ / ドラッグ開始 public NodeDragController(NodeDragControllerSetupArgs setupArgs) { if (setupArgs.Args.LeftButton == MouseButtonState.Pressed) { _isDrag = true; _dragStartPos = setupArgs.Args.GetPosition(setupArgs.BaseControl); _originalPoints = setupArgs.Nodes.ToDictionary(x => x, x => new Point(x.X, x.Y)); } _completedNodeMove = setupArgs.CompletedCommand; _selectedNodes = setupArgs.Nodes; _useSnapGrid = setupArgs.UseSnapGrid; _inputElement = setupArgs.BaseControl; _gridSize = setupArgs.GridSize; if (_selectedNodes.Any()) { var control = _selectedNodes.First().FindVisualParentWithType <InfiniteScrollViewer>(); if (Mouse.Captured == null) { _isCaptured = _inputElement.CaptureMouse(); } _scrollViewer = control; } }
public IDragController Build() { var setupArgs = new NodeDragControllerSetupArgs( _dragControllerBuilder.InputElement, _dragControllerBuilder.SelectedNodes, _dragControllerBuilder.CompletedNodeDragCommand, ScrollViewer) { GridSize = SnapGridSize, UseSnapGrid = UseSnapGrid, }; return(new NodesDragController(setupArgs)); }