Beispiel #1
0
        public void OnConnectionDragging(Point currentDragPoint, ConnectionViewModel connectionViewModel)
        {
            // If current drag point is close to an input connection, show its snapped position.
            //var nearbyConnector = FindNearbyInputConnector(currentDragPoint);
            //connectionViewModel.ToPosition = (nearbyConnector != null)
            //    ? nearbyConnector.Position
            //    : currentDragPoint;

            connectionViewModel.ToPosition = currentDragPoint;
        }
Beispiel #2
0
        public void OnConnectionDragCompleted(Point currentDragPoint, ConnectionViewModel newConnection)
        {
            //var nearbyConnector = FindNearbyInputConnector(currentDragPoint);

            //if (nearbyConnector == null)
            //{
            //    _client.UndoManager.CancelTransaction();
            //    return;
            //}

            //newConnection.AddToConnector(nearbyConnector, _client);

            newConnection.ToPosition = currentDragPoint;

            _client.UndoManager.EndTransaction();
        }
Beispiel #3
0
        public ConnectionViewModel OnConnectionDragStarted(Point currentDragPoint)
        {
            _client.UndoManager.StartTransaction("New connection drag started");

            var connection = _sheet.CreateConnection();

            connection.FromPosition = new AplayPoint(currentDragPoint.X, currentDragPoint.Y);
            connection.ToPosition   = new AplayPoint(currentDragPoint.X, currentDragPoint.Y);

            _sheet.AddConnection(connection, _client);

            var connectionViewModel = new ConnectionViewModel(connection, _client, _inspectorTool)
            {
                ToPosition = currentDragPoint
            };

            return(connectionViewModel);
        }
Beispiel #4
0
        private void DeleteConnection(ConnectionViewModel connection)
        {
            var toBeDeleted = _sheet.Connections.FirstOrDefault(c => c.Id == connection.Id);

            _sheet.RemoveConnection(toBeDeleted, _client);
        }