|
@@ -4,18 +4,13 @@ using ComPDFKit.PDFAnnotation;
|
|
|
using ComPDFKit.Tool.SettingParam;
|
|
|
using ComPDFKit.Viewer.Helper;
|
|
|
using ComPDFKitViewer;
|
|
|
-using ComPDFKitViewer.Annot;
|
|
|
using ComPDFKitViewer.Helper;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
-using System.Diagnostics;
|
|
|
using System.Linq;
|
|
|
-using System.Net;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Media;
|
|
|
-using System.Windows.Media.TextFormatting;
|
|
|
-using static ComPDFKit.Tool.Help.ImportWin32;
|
|
|
|
|
|
namespace ComPDFKit.Tool.DrawTool
|
|
|
{
|
|
@@ -188,17 +183,17 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
case C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE:
|
|
|
break;
|
|
|
case C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON:
|
|
|
- for (int i = 0; i < (annotData.Annot as CPDFPolygonAnnotation).Points.Count; i++)
|
|
|
- {
|
|
|
- Point point = DpiHelper.PDFPointToStandardPoint(new Point((annotData.Annot as CPDFPolygonAnnotation).Points[i].x, (annotData.Annot as CPDFPolygonAnnotation).Points[i].y));
|
|
|
- point = new Point(
|
|
|
- point.X * annotData.CurrentZoom + annotData.PaintOffset.X - annotData.CropLeft * annotData.CurrentZoom,
|
|
|
- point.Y * annotData.CurrentZoom + annotData.PaintOffset.Y - annotData.CropTop * annotData.CurrentZoom
|
|
|
- );
|
|
|
- activePoints.Add(point);
|
|
|
- }
|
|
|
- if ((annotData.Annot as CPDFPolygonAnnotation).IsMeasured())
|
|
|
{
|
|
|
+ for (int i = 0; i < (annotData.Annot as CPDFPolygonAnnotation).Points.Count; i++)
|
|
|
+ {
|
|
|
+ Point point = DpiHelper.PDFPointToStandardPoint(new Point((annotData.Annot as CPDFPolygonAnnotation).Points[i].x, (annotData.Annot as CPDFPolygonAnnotation).Points[i].y));
|
|
|
+ point = new Point(
|
|
|
+ point.X * annotData.CurrentZoom + annotData.PaintOffset.X - annotData.CropLeft * annotData.CurrentZoom,
|
|
|
+ point.Y * annotData.CurrentZoom + annotData.PaintOffset.Y - annotData.CropTop * annotData.CurrentZoom
|
|
|
+ );
|
|
|
+ activePoints.Add(point);
|
|
|
+ }
|
|
|
+
|
|
|
CRect rawRect = annotData.Annot.GetRect();
|
|
|
Rect rect = DataConversionForWPF.CRectConversionForRect(rawRect);
|
|
|
rect = DpiHelper.PDFRectToStandardRect(rect);
|
|
@@ -210,18 +205,19 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
);
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
case C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE:
|
|
|
- for (int i = 0; i < (annotData.Annot as CPDFPolylineAnnotation).Points.Count; i++)
|
|
|
- {
|
|
|
- Point point = DpiHelper.PDFPointToStandardPoint(new Point((annotData.Annot as CPDFPolylineAnnotation).Points[i].x, (annotData.Annot as CPDFPolylineAnnotation).Points[i].y));
|
|
|
- point = new Point(
|
|
|
- point.X * annotData.CurrentZoom + annotData.PaintOffset.X - annotData.CropLeft * annotData.CurrentZoom,
|
|
|
- point.Y * annotData.CurrentZoom + annotData.PaintOffset.Y - annotData.CropTop * annotData.CurrentZoom
|
|
|
- );
|
|
|
- activePoints.Add(point);
|
|
|
- }
|
|
|
- if ((annotData.Annot as CPDFPolylineAnnotation).IsMeasured())
|
|
|
{
|
|
|
+ for (int i = 0; i < (annotData.Annot as CPDFPolylineAnnotation).Points.Count; i++)
|
|
|
+ {
|
|
|
+ Point point = DpiHelper.PDFPointToStandardPoint(new Point((annotData.Annot as CPDFPolylineAnnotation).Points[i].x, (annotData.Annot as CPDFPolylineAnnotation).Points[i].y));
|
|
|
+ point = new Point(
|
|
|
+ point.X * annotData.CurrentZoom + annotData.PaintOffset.X - annotData.CropLeft * annotData.CurrentZoom,
|
|
|
+ point.Y * annotData.CurrentZoom + annotData.PaintOffset.Y - annotData.CropTop * annotData.CurrentZoom
|
|
|
+ );
|
|
|
+ activePoints.Add(point);
|
|
|
+ }
|
|
|
+
|
|
|
CRect rawRect = annotData.Annot.GetRect();
|
|
|
Rect rect = DataConversionForWPF.CRectConversionForRect(rawRect);
|
|
|
rect = DpiHelper.PDFRectToStandardRect(rect);
|
|
@@ -233,6 +229,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
);
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
case C_ANNOTATION_TYPE.C_ANNOTATION_HIGHLIGHT:
|
|
|
break;
|
|
|
case C_ANNOTATION_TYPE.C_ANNOTATION_UNDERLINE:
|
|
@@ -362,7 +359,6 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
{
|
|
|
Tag = isMouseDown;
|
|
|
mouseEndDrawPoint = mousePoint;
|
|
|
-
|
|
|
Point newOffset = new Point(
|
|
|
mouseEndDrawPoint.X - mouseDownPoint.X,
|
|
|
mouseEndDrawPoint.Y - mouseDownPoint.Y
|
|
@@ -385,26 +381,30 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
|
|
|
public virtual void OnMouseLeftButtonUp(Point upPoint)
|
|
|
{
|
|
|
+ if (annotData == null)
|
|
|
+ return;
|
|
|
+
|
|
|
isMouseDown = false;
|
|
|
- Draw();
|
|
|
- if (annotData!=null&&annotData.AnnotType == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
|
+ if (annotData.AnnotType == C_ANNOTATION_TYPE.C_ANNOTATION_LINE)
|
|
|
{
|
|
|
if ((annotData.Annot as CPDFLineAnnotation).IsMeasured())
|
|
|
{
|
|
|
activePoints.Clear();
|
|
|
-
|
|
|
if (moveLeftLine == null)
|
|
|
{
|
|
|
moveLeftLine = leftLine.ToArray();
|
|
|
}
|
|
|
+
|
|
|
if (moveRightLine == null)
|
|
|
{
|
|
|
moveRightLine = rightLine.ToArray();
|
|
|
}
|
|
|
+
|
|
|
if (moveCrossLine == null)
|
|
|
{
|
|
|
moveCrossLine = crossLine.ToArray();
|
|
|
}
|
|
|
+
|
|
|
activePoints.Add(moveLeftLine[0]);
|
|
|
activePoints.Add(moveLeftLine[1]);
|
|
|
activePoints.Add(moveRightLine[0]);
|
|
@@ -413,6 +413,7 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
activePoints.Add(moveCrossLine[1]);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
moveLeftLine = null;
|
|
|
moveRightLine = null;
|
|
|
moveCrossLine = null;
|
|
@@ -420,11 +421,13 @@ namespace ComPDFKit.Tool.DrawTool
|
|
|
{
|
|
|
InvokeDataChangEvent(true);
|
|
|
}
|
|
|
+
|
|
|
moveOffset = new Point(0, 0);
|
|
|
mouseDownPoint = new Point();
|
|
|
-
|
|
|
mouseEndDrawPoint = new Point();
|
|
|
hitIndex = -1;
|
|
|
+
|
|
|
+ SetAnnotObject(annotData);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|