|
@@ -77,7 +77,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
|
|
|
public AnnotData annotData { get; set; }
|
|
|
|
|
|
- public double rotationAngle { get; set; }
|
|
|
+ public int rotationAngle { get; set; }
|
|
|
}
|
|
|
|
|
|
public partial class SelectedRect : DrawingVisual
|
|
@@ -266,7 +266,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
case PointControlType.Line:
|
|
|
return Cursors.SizeAll;
|
|
|
case PointControlType.Rotate:
|
|
|
- return CommonHelper.RotationCursor;
|
|
|
+ // return CommonHelper.RotationCursor;
|
|
|
default:
|
|
|
return Cursors.Arrow;
|
|
|
}
|
|
@@ -298,7 +298,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
SolidColorBrush moveBrush = DrawParam.AnnotMoveBrush;
|
|
|
Pen movepen = DrawParam.AnnotMovePen;
|
|
|
|
|
|
- GetMoveBrushAndPen(ref moveBrush, ref movepen);
|
|
|
+ GetMoveBrushAndPen(ref moveBrush, ref movepen);
|
|
|
if (selectedType == SelectedType.PDFEdit)
|
|
|
{
|
|
|
DrawMoveBounds(drawDC, hitControlType, movepen, moveBrush, drawRect, DrawParam.PDFEditMoveRectPen);
|
|
@@ -488,6 +488,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
public virtual void ClearDraw()
|
|
|
{
|
|
|
SetDrawRect = drawRect = new Rect();
|
|
|
+ rotateAngle = 0;
|
|
|
drawDC = RenderOpen();
|
|
|
drawDC?.Close();
|
|
|
drawDC = null;
|
|
@@ -520,12 +521,22 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
/// <param name="newRect">
|
|
|
/// The new rect to set
|
|
|
/// </param>
|
|
|
- public Rect GetRect()
|
|
|
+ public Rect GetRect()
|
|
|
{
|
|
|
Rect rect = new Rect(drawRect.X + rectPadding * currentZoom, drawRect.Y + rectPadding * currentZoom, Math.Max(rectMinWidth, drawRect.Width - 2 * rectPadding * currentZoom), Math.Max(RectMinHeight, drawRect.Height - 2 * rectPadding * currentZoom));
|
|
|
return rect;
|
|
|
}
|
|
|
|
|
|
+ public int GetRotation()
|
|
|
+ {
|
|
|
+ return rotateAngle;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void SetRotation(int rotationAngle)
|
|
|
+ {
|
|
|
+ this.rotateAngle = rotationAngle;
|
|
|
+ }
|
|
|
+
|
|
|
public void SetRectPadding(double rectPadding)
|
|
|
{
|
|
|
this.rectPadding = rectPadding;
|
|
@@ -628,7 +639,8 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
break;
|
|
|
}
|
|
|
SetMaxRect(annotData.PaintOffset);
|
|
|
- SetRect(annotData.PaintRect, annotData.CurrentZoom);
|
|
|
+ SetRect(annotData.PaintRect, annotData.CurrentZoom);
|
|
|
+ SetRotation(annotData.Rotation);
|
|
|
selectedRectData = new SelectedAnnotData();
|
|
|
selectedRectData.annotData = annotData;
|
|
|
}
|
|
@@ -921,7 +933,11 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
}
|
|
|
if (canRotation)
|
|
|
{
|
|
|
- Vector checkVector1 = point - rotationPoint;
|
|
|
+ // rotationPoint 围绕centerPoint旋转angle度
|
|
|
+
|
|
|
+ Point hitRotationPoint = new Point(centerPoint.X + (rotationPoint.X - centerPoint.X) * Math.Cos(rotateAngle * Math.PI / 180) - (rotationPoint.Y - centerPoint.Y) * Math.Sin(rotateAngle * Math.PI / 180),
|
|
|
+ centerPoint.Y + (rotationPoint.X - centerPoint.X) * Math.Sin(rotateAngle * Math.PI / 180) + (rotationPoint.Y - centerPoint.Y) * Math.Cos(rotateAngle * Math.PI / 180));
|
|
|
+ Vector checkVector1 = point - hitRotationPoint;
|
|
|
|
|
|
if (checkVector1.Length < pointSize)
|
|
|
{
|