ComponentFactory.Krypton.Toolkit.SeparatorController.RecalcClient C# (CSharp) Method

RecalcClient() private method

private RecalcClient ( Point pt ) : Point
pt Point
return Point
        private Point RecalcClient(Point pt)
        {
            // Find the delta between the incoming point and the original mouse down
            int xDelta = pt.X - _downPosition.X;
            int yDelta = pt.Y - _downPosition.Y;

            // Enforce the movement box limits
            if (_separatorOrientation == Orientation.Vertical)
            {
                if (Target.ClientLocation.X + xDelta < _separatorBox.Left)
                    xDelta = _separatorBox.Left - Target.ClientLocation.X;

                if (Target.ClientLocation.X + xDelta > _separatorBox.Right)
                    xDelta = _separatorBox.Right - Target.ClientLocation.X;
            }
            else
            {
                if (Target.ClientLocation.Y + yDelta < _separatorBox.Top)
                    yDelta = _separatorBox.Top - Target.ClientLocation.Y;

                if (Target.ClientLocation.Y + yDelta > _separatorBox.Bottom)
                    yDelta = _separatorBox.Bottom - Target.ClientLocation.Y;
            }

            // Enforce the increments on the deltas
            xDelta -= xDelta % _separatorIncrements;
            yDelta -= yDelta % _separatorIncrements;

            // Return the top left point of the client by the delta
            return new Point(Target.ClientLocation.X + xDelta,
                             Target.ClientLocation.Y + yDelta);
        }