public static RotateTransform GetRotateTransform(Point hoverPoint, double pageWidth, double pageHeight, FoldPosition draggedCorner, PagePosition position) { RotateTransform rotateTransform = new RotateTransform(); double num1 = draggedCorner == FoldPosition.TopRight || draggedCorner == FoldPosition.BottomRight ? pageWidth - hoverPoint.X : hoverPoint.X; double y = hoverPoint.Y; double curlY = CurlCalculator.GetCurlY(num1, y); if (position == PagePosition.Left) { double num2 = 0.0; double num3 = hoverPoint.Y > 0.0 ? 0.0 : pageHeight; double d = Math.Atan2(num1, curlY - y) * 180.0 / Math.PI; if (double.IsNaN(d) || double.IsInfinity(d) || d < 0.0) { d = 0.0; } rotateTransform.CenterY = num3; rotateTransform.CenterX = num2; rotateTransform.Angle = hoverPoint.Y >= 0.0 ? -d : 180.0 - d; } else { double num2 = pageWidth; double num3 = hoverPoint.Y > 0.0 ? 0.0 : pageHeight; double d = Math.Atan2(num1, curlY - y) * 180.0 / Math.PI; if (double.IsNaN(d) || double.IsInfinity(d) || d < 0.0) { d = 0.0; } rotateTransform.CenterY = num3; rotateTransform.CenterX = num2; rotateTransform.Angle = hoverPoint.Y >= 0.0 ? d : d - 180.0; } return(rotateTransform); }
public static PathGeometry GetRightSideBackPageClip(Point hoverPoint, double pageWidth, double pageHeight) { double x = pageWidth - hoverPoint.X; double y = hoverPoint.Y; double curlX = CurlCalculator.GetCurlX(x, y); double curlY = CurlCalculator.GetCurlY(x, y); if (hoverPoint.Y >= 0.0) { if (curlY < pageHeight) { return(GeometryBuilder.BuildPathGeometry(new Point(0.0, 0.0), new Point(curlX, 0.0), new Point(0.0, curlY))); } else { return(GeometryBuilder.BuildPathGeometry(new Point(0.0, 0.0), new Point(curlX, 0.0), new Point(curlX * (curlY - pageHeight) / curlY, pageHeight), new Point(0.0, pageHeight))); } } else { double num = -curlY; if (num < pageHeight) { return(GeometryBuilder.BuildPathGeometry(new Point(0.0, pageHeight - num), new Point(0.0, pageHeight), new Point(curlX, pageHeight))); } else { return(GeometryBuilder.BuildPathGeometry(new Point(0.0, pageHeight), new Point(curlX, pageHeight), new Point(curlX * (num - pageHeight) / num, 0.0), new Point(0.0, 0.0))); } } }