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