TpTrayUtility.Components.ImageViewPort.GetDelta C# (CSharp) Method

GetDelta() private method

private GetDelta ( RectangleF boundRect, PointF canvasOffset ) : PointF
boundRect System.Drawing.RectangleF
canvasOffset System.Drawing.PointF
return System.Drawing.PointF
		private PointF GetDelta(RectangleF boundRect, PointF canvasOffset)
		{
			float deltaX = boundRect.X < canvasOffset.X ? canvasOffset.X - boundRect.X : 0;
			float deltaY = boundRect.Y < canvasOffset.Y ? canvasOffset.Y - boundRect.Y : 0;

			deltaX = boundRect.Width + boundRect.X > ClientSize.Width - canvasOffset.X
			         	? ClientSize.Width - canvasOffset.X - boundRect.Width - boundRect.X
			         	: deltaX;

			deltaY = boundRect.Height + boundRect.Y > ClientSize.Height - canvasOffset.Y
			         	? ClientSize.Height - canvasOffset.Y - boundRect.Height - boundRect.Y
			         	: deltaY;

			deltaX = boundRect.Width > ClientSize.Width ? -boundRect.X : deltaX;
			deltaY = boundRect.Height > ClientSize.Height ? -boundRect.Y : deltaY;


			return new PointF(deltaX, deltaY);
		}