/// <summary>
 /// The node is dragged.
 /// </summary>
 public void HandleMove(IInputModeContext context, PointD originalLocation, PointD newLocation)
 {
     handler.HandleMove(context, originalLocation, newLocation);
     // stop changing the graph layout during re-parenting is taking place
     if (reparentHandler == null || !reparentHandler.IsReparentGesture(context, node))
     {
         layoutHelper.RunLayout();
     }
 }
            /// <summary>
            /// Constrains the movement to one axis. This is done by calculating the
            /// constrained location for the given new location, and invoking the
            /// original handler with the constrained location.
            /// </summary>
            public void HandleMove(IInputModeContext context, PointD originalLocation, PointD newLocation)
            {
                // The larger difference in coordinates specifies whether this is
                // a horizontal or vertical movement.
                PointD delta = newLocation - originalLocation;

                if (Math.Abs(delta.X) > Math.Abs(delta.Y))
                {
                    newLocation = new PointD(newLocation.X, originalLocation.Y);
                }
                else
                {
                    newLocation = new PointD(originalLocation.X, newLocation.Y);
                }
                if (newLocation != lastLocation)
                {
                    handler.HandleMove(context, originalLocation, newLocation);
                    lastLocation = newLocation;
                }
            }
Пример #3
0
 /// <summary>
 /// The subtree is dragged.
 /// </summary>
 public void HandleMove(IInputModeContext context, PointD originalLocation, PointD newLocation)
 {
     compositeHandler.HandleMove(context, originalLocation, newLocation);
     layoutHelper.RunLayout();
 }