|
@@ -13,7 +13,6 @@ using ComPDFKitViewer.Helper;
|
|
|
using ComPDFKitViewer.Layer;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
-using System.Diagnostics;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading;
|
|
@@ -112,7 +111,7 @@ namespace ComPDFKit.Tool
|
|
|
private int selectedEditAreaIndex = -1;
|
|
|
private bool selectAllCharsForLine = false;
|
|
|
private CPoint rawHitPos;
|
|
|
- private CPDFEditType contentEditType = CPDFEditType.EditText | CPDFEditType.EditImage;
|
|
|
+ private CPDFEditType contentEditType = CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath;
|
|
|
|
|
|
/// <summary>
|
|
|
/// Save Current Crop Box
|
|
@@ -151,6 +150,10 @@ namespace ComPDFKit.Tool
|
|
|
|
|
|
private List<SelectedRect> text = new List<SelectedRect>();
|
|
|
|
|
|
+ private List<SelectedRect> path = new List<SelectedRect>();
|
|
|
+
|
|
|
+ private List<CPDFEditPathArea> cachePathList = new List<CPDFEditPathArea>();
|
|
|
+
|
|
|
protected List<PointControlType> ignoreTextPoints { get; set; } = new List<PointControlType>();
|
|
|
|
|
|
protected List<PointControlType> ignoreImagePoints { get; set; } = new List<PointControlType>();
|
|
@@ -234,6 +237,11 @@ namespace ComPDFKit.Tool
|
|
|
selectedEditPageIndex = pageIndex;
|
|
|
selectedEditAreaIndex = editAreaIndex;
|
|
|
this.drawCaret = drawCaret;
|
|
|
+ //if ((pageIndex < 0 || editAreaIndex < 0) && cachePathList.Count != 0)
|
|
|
+ //{
|
|
|
+ // cachePathList.Clear();
|
|
|
+ // cachePathList = new List<CPDFEditPathArea>();
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -384,36 +392,40 @@ namespace ComPDFKit.Tool
|
|
|
hitTestRects.Clear();
|
|
|
image.Clear();
|
|
|
text.Clear();
|
|
|
- BaseLayer customizeLayer = PDFViewer.GetViewForTag(textEditTag);
|
|
|
+ path.Clear();
|
|
|
|
|
|
+ BaseLayer customizeLayer = PDFViewer.GetViewForTag(textEditTag);
|
|
|
customizeLayer.Children.Clear();
|
|
|
operateChildrenIndex = -1;
|
|
|
CaretVisual caretVisual = new CaretVisual(GetDefaultDrawParam());
|
|
|
customizeLayer.Children.Add(caretVisual);
|
|
|
-
|
|
|
- currentZoom = currentRenderFrame.ZoomFactor;
|
|
|
-
|
|
|
foreach (RenderData item in currentRenderFrame.GetRenderDatas())
|
|
|
{
|
|
|
if (item.CPDFEditPageObj == null)
|
|
|
- {
|
|
|
continue;
|
|
|
- }
|
|
|
+
|
|
|
foreach (CPDFEditArea editArea in item.CPDFEditPageObj.GetEditAreaList())
|
|
|
{
|
|
|
+ if (editArea is CPDFEditPathArea)
|
|
|
+ {
|
|
|
+ if (!cachePathList.Contains(editArea))
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
SelectedRect selectedRect = new SelectedRect(GetDefaultDrawParam(), SelectedType.PDFEdit);
|
|
|
selectedRect.SetEditPen(editPen, editHoverPen);
|
|
|
selectedRect.SetDrawMoveType(DrawMoveType.kReferenceLine);
|
|
|
customizeLayer.Children.Add(selectedRect);
|
|
|
|
|
|
- Rect TextBlock = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
|
|
|
+ Rect editAreaRect = new Rect();
|
|
|
if (editArea.Type == CPDFEditType.EditImage)
|
|
|
{
|
|
|
if ((contentEditType & CPDFEditType.EditImage) != CPDFEditType.EditImage)
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
- TextBlock = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditImageArea).GetClipRect());
|
|
|
+
|
|
|
+ editAreaRect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditImageArea).GetClipRect());
|
|
|
}
|
|
|
else if (editArea.Type == CPDFEditType.EditText)
|
|
|
{
|
|
@@ -421,21 +433,35 @@ namespace ComPDFKit.Tool
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
+ editAreaRect = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
|
|
|
}
|
|
|
- Rect rect = TextBlock;
|
|
|
+ else if (editArea.Type == CPDFEditType.EditPath)
|
|
|
+ {
|
|
|
+ if ((contentEditType & CPDFEditType.EditPath) != CPDFEditType.EditPath)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- rect.X = (rect.X) * currentRenderFrame.ZoomFactor;
|
|
|
- rect.Y = (rect.Y) * currentRenderFrame.ZoomFactor;
|
|
|
- rect.Width *= currentRenderFrame.ZoomFactor;
|
|
|
- rect.Height *= currentRenderFrame.ZoomFactor;
|
|
|
- rect = DpiHelper.PDFRectToStandardRect(rect);
|
|
|
+ editAreaRect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditPathArea).GetClipRect());
|
|
|
+ }
|
|
|
|
|
|
- rect.X += item.PageBound.X;
|
|
|
- rect.Y += item.PageBound.Y;
|
|
|
+ editAreaRect.X = (editAreaRect.X) * currentZoom;
|
|
|
+ editAreaRect.Y = (editAreaRect.Y) * currentZoom;
|
|
|
+ editAreaRect.Width *= currentZoom;
|
|
|
+ editAreaRect.Height *= currentZoom;
|
|
|
+ editAreaRect = DpiHelper.PDFRectToStandardRect(editAreaRect);
|
|
|
+ editAreaRect.X += item.PageBound.X;
|
|
|
+ editAreaRect.Y += item.PageBound.Y;
|
|
|
+
|
|
|
+ if (editArea is CPDFEditPathArea)
|
|
|
+ {
|
|
|
+ selectedRect.RectMinHeight = 1;
|
|
|
+ selectedRect.RectMinWidth = 1;
|
|
|
+ }
|
|
|
|
|
|
- //PDF对象设置界面矩形
|
|
|
selectedRect.SetRectPadding(5);
|
|
|
- selectedRect.SetRect(rect, currentZoom);
|
|
|
+ selectedRect.SetRect(editAreaRect, currentZoom);
|
|
|
selectedRect.SetMaxRect(item.PageBound);
|
|
|
selectedRect.SetIgnorePointsAll();
|
|
|
selectedRect.Draw();
|
|
@@ -459,13 +485,18 @@ namespace ComPDFKit.Tool
|
|
|
case CPDFEditType.EditImage:
|
|
|
image.Add(selectedRect);
|
|
|
break;
|
|
|
+ case CPDFEditType.EditPath:
|
|
|
+ path.Add(selectedRect);
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
hitTestRects.AddRange(text);
|
|
|
hitTestRects.AddRange(image);
|
|
|
+ hitTestRects.AddRange(path);
|
|
|
}
|
|
|
|
|
|
public void DrawStartTextEdit(SelectedRect selectedRect, EditAreaObject editAreaObject)
|
|
@@ -759,6 +790,35 @@ namespace ComPDFKit.Tool
|
|
|
return multiSelectedRect;
|
|
|
}
|
|
|
|
|
|
+ private void GetDrawPathList(Point point)
|
|
|
+ {
|
|
|
+ if ((contentEditType & CPDFEditType.EditPath) != CPDFEditType.EditPath)
|
|
|
+ return;
|
|
|
+
|
|
|
+ PDFViewer.GetePointToPage(point, out RenderData renderData, out Point pagePoint);
|
|
|
+ pagePoint = new Point(pagePoint.X / currentZoom, pagePoint.Y / currentZoom);
|
|
|
+ if (renderData == null || renderData.CPDFEditPageObj == null)
|
|
|
+ return;
|
|
|
+
|
|
|
+ foreach (CPDFEditArea editArea in renderData.CPDFEditPageObj.GetEditAreaList())
|
|
|
+ {
|
|
|
+ if (editArea is CPDFEditPathArea)
|
|
|
+ {
|
|
|
+ CPDFEditPathArea pathArea = editArea as CPDFEditPathArea;
|
|
|
+ Rect rect = DataConversionForWPF.CRectConversionForRect(pathArea.GetClipRect());
|
|
|
+ rect = DpiHelper.PDFRectToStandardRect(rect);
|
|
|
+ if (rect.Contains(pagePoint))
|
|
|
+ {
|
|
|
+ if (cachePathList.Contains(pathArea) == false)
|
|
|
+ {
|
|
|
+ cachePathList.Add(pathArea);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Select
|
|
|
/// </summary>
|
|
@@ -773,6 +833,7 @@ namespace ComPDFKit.Tool
|
|
|
SetPastePoint(new Point(-1, -1));
|
|
|
SelectedEditAreaForIndex(-1, -1);
|
|
|
Point point = Mouse.GetPosition(this);
|
|
|
+ //GetDrawPathList(point);
|
|
|
CaretVisual caretVisual = CommonHelper.FindVisualChild<CaretVisual>(PDFViewer.GetViewForTag(textEditTag));
|
|
|
|
|
|
EditAreaObject editAreaObject = null;
|
|
@@ -808,9 +869,9 @@ namespace ComPDFKit.Tool
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-
|
|
|
pointControlType = rect.GetHitControlIndex(point);
|
|
|
}
|
|
|
+
|
|
|
editArea.TryGetValue(rect, out EditAreaObject editObject);
|
|
|
if (pointControlType != PointControlType.None)
|
|
|
{
|
|
@@ -954,7 +1015,6 @@ namespace ComPDFKit.Tool
|
|
|
lastSelectedRect.Draw();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (editAreaObject.cPDFEditArea is CPDFEditTextArea)
|
|
|
{
|
|
|
string chars = (editAreaObject.cPDFEditArea as CPDFEditTextArea).GetAllChars();
|
|
@@ -966,16 +1026,27 @@ namespace ComPDFKit.Tool
|
|
|
lastSelectedRect.ClearDraw();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
lastSelectedRect.DataChanged -= LastSelectedRect_DataChanged;
|
|
|
if (lastSelectedRect.GetCurrentDrawPointType() != DrawPointType.Crop)
|
|
|
{
|
|
|
lastSelectedRect = null;
|
|
|
}
|
|
|
+
|
|
|
+ //cachePathList.Clear();
|
|
|
+ //cachePathList = new List<CPDFEditPathArea>();
|
|
|
+ //GetDrawPathList(point);
|
|
|
}
|
|
|
+
|
|
|
+ if(editAreaList.Count == 0)
|
|
|
+ {
|
|
|
+ cachePathList.Clear();
|
|
|
+ cachePathList = new List<CPDFEditPathArea>();
|
|
|
+ GetDrawPathList(point);
|
|
|
+ }
|
|
|
+
|
|
|
caretVisual?.StopTimer();
|
|
|
caretVisual?.CleanDraw();
|
|
|
-
|
|
|
- return;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1060,7 +1131,6 @@ namespace ComPDFKit.Tool
|
|
|
|
|
|
keyValuePairs.Add(currentEditAreaObject.PageIndex, OldRect);
|
|
|
DrawUpdateText(keyValuePairs, currentEditAreaObject.PageBound);
|
|
|
-
|
|
|
UpdateSelectRect(editAreaObject.cPDFEditArea);
|
|
|
|
|
|
// Move the moved selected box to the top layer of the selected logic
|
|
@@ -1074,10 +1144,19 @@ namespace ComPDFKit.Tool
|
|
|
image.Remove(selectedRect);
|
|
|
image.Insert(0, selectedRect);
|
|
|
break;
|
|
|
+ case CPDFEditType.EditPath:
|
|
|
+ path.Remove(selectedRect);
|
|
|
+ path.Insert(0, selectedRect);
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
+
|
|
|
hitTestRects.Clear();
|
|
|
hitTestRects.AddRange(text);
|
|
|
hitTestRects.AddRange(image);
|
|
|
+ hitTestRects.AddRange(path);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1279,6 +1358,7 @@ namespace ComPDFKit.Tool
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
if (editAreaObject.cPDFEditArea is CPDFEditTextArea)
|
|
|
{
|
|
|
CPDFEditPage editPage = editAreaObject.cPDFEditPage;
|
|
@@ -1289,7 +1369,6 @@ namespace ComPDFKit.Tool
|
|
|
Rect.ClearDraw();
|
|
|
}
|
|
|
}
|
|
|
- SelectedEditAreaForIndex(-1, -1);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -1298,15 +1377,13 @@ namespace ComPDFKit.Tool
|
|
|
if (areaObject.cPDFEditArea is CPDFEditTextArea)
|
|
|
{
|
|
|
CPDFEditPage editPage = areaObject.cPDFEditPage;
|
|
|
- CPDFEditTextArea textArea = areaObject.cPDFEditArea as CPDFEditTextArea;
|
|
|
- int index = areaObject.EditAreaIndex;
|
|
|
- editPage.RemoveEditArea(index);
|
|
|
+ editPage.RemoveEditArea(areaObject.EditAreaIndex);
|
|
|
editPage.EndEdit();
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
- SelectedEditAreaForIndex(-1, -1);
|
|
|
}
|
|
|
+
|
|
|
+ SelectedEditAreaForIndex(-1, -1);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1324,17 +1401,17 @@ namespace ComPDFKit.Tool
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
if (editAreaObject.cPDFEditArea is CPDFEditImageArea)
|
|
|
{
|
|
|
CPDFEditPage editPage = editAreaObject.cPDFEditPage;
|
|
|
- CPDFEditImageArea textArea = editAreaObject.cPDFEditArea as CPDFEditImageArea;
|
|
|
- int index = editAreaObject.cPDFEditPage.GetEditAreaList().IndexOf(textArea);
|
|
|
+ CPDFEditImageArea imageArea = editAreaObject.cPDFEditArea as CPDFEditImageArea;
|
|
|
+ int index = editAreaObject.cPDFEditPage.GetEditAreaList().IndexOf(imageArea);
|
|
|
editPage.RemoveEditArea(index);
|
|
|
editPage.EndEdit();
|
|
|
Rect.ClearDraw();
|
|
|
}
|
|
|
}
|
|
|
- SelectedEditAreaForIndex(-1, -1);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -1343,14 +1420,51 @@ namespace ComPDFKit.Tool
|
|
|
if (areaObject.cPDFEditArea is CPDFEditImageArea)
|
|
|
{
|
|
|
CPDFEditPage editPage = areaObject.cPDFEditPage;
|
|
|
- CPDFEditImageArea textArea = areaObject.cPDFEditArea as CPDFEditImageArea;
|
|
|
- int index = areaObject.EditAreaIndex;
|
|
|
+ editPage.RemoveEditArea(areaObject.EditAreaIndex);
|
|
|
+ editPage.EndEdit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ SelectedEditAreaForIndex(-1, -1);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void RemovePathBlock(EditAreaObject areaObject = null)
|
|
|
+ {
|
|
|
+ if (currentEditAreaObject != null && currentEditAreaObject.cPDFEditPage != null)
|
|
|
+ {
|
|
|
+ foreach (var Rect in hitTestRects)
|
|
|
+ {
|
|
|
+ editArea.TryGetValue(Rect, out EditAreaObject editAreaObject);
|
|
|
+ if (editAreaObject != currentEditAreaObject)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (editAreaObject.cPDFEditArea is CPDFEditPathArea)
|
|
|
+ {
|
|
|
+ CPDFEditPage editPage = editAreaObject.cPDFEditPage;
|
|
|
+ CPDFEditPathArea pathArea = editAreaObject.cPDFEditArea as CPDFEditPathArea;
|
|
|
+ int index = editAreaObject.cPDFEditPage.GetEditAreaList().IndexOf(pathArea);
|
|
|
editPage.RemoveEditArea(index);
|
|
|
editPage.EndEdit();
|
|
|
+ Rect.ClearDraw();
|
|
|
}
|
|
|
}
|
|
|
- SelectedEditAreaForIndex(-1, -1);
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (areaObject != null && areaObject.cPDFEditPage != null)
|
|
|
+ {
|
|
|
+ if (areaObject.cPDFEditArea is CPDFEditPathArea)
|
|
|
+ {
|
|
|
+ CPDFEditPage editPage = areaObject.cPDFEditPage;
|
|
|
+ editPage.RemoveEditArea(areaObject.EditAreaIndex);
|
|
|
+ editPage.EndEdit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ SelectedEditAreaForIndex(-1, -1);
|
|
|
}
|
|
|
|
|
|
public void CleanEditView()
|
|
@@ -1614,7 +1728,7 @@ namespace ComPDFKit.Tool
|
|
|
if (pointControlType != PointControlType.None)
|
|
|
{
|
|
|
EditAreaObject editAreaObject = GetEditAreaObjectForRect(rect);
|
|
|
- if (editAreaObject.cPDFEditArea.Type == CPDFEditType.EditImage)
|
|
|
+ if (editAreaObject.cPDFEditArea.Type == CPDFEditType.EditImage || editAreaObject.cPDFEditArea.Type == CPDFEditType.EditPath)
|
|
|
{
|
|
|
//image hover
|
|
|
if (selectedRect1 == null)
|
|
@@ -1678,7 +1792,7 @@ namespace ComPDFKit.Tool
|
|
|
return cursor;
|
|
|
}
|
|
|
|
|
|
- private Cursor GetCursors(PointControlType controlType, bool isImage)
|
|
|
+ private Cursor GetCursors(PointControlType controlType, bool notText)
|
|
|
{
|
|
|
switch (controlType)
|
|
|
{
|
|
@@ -1699,7 +1813,7 @@ namespace ComPDFKit.Tool
|
|
|
return Cursors.SizeNS;
|
|
|
|
|
|
case PointControlType.Body:
|
|
|
- if (isImage)
|
|
|
+ if (notText)
|
|
|
{
|
|
|
return Cursors.SizeAll;
|
|
|
}
|
|
@@ -1874,17 +1988,32 @@ namespace ComPDFKit.Tool
|
|
|
selectedRect = item.Key;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (selectedRect != null)
|
|
|
{
|
|
|
Rect maxrect = selectedRect.GetMaxRect();
|
|
|
- Rect rect = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
|
|
|
- if (editArea.Type == CPDFEditType.EditImage)
|
|
|
+ Rect rect = new Rect();
|
|
|
+ if (editArea.Type == CPDFEditType.EditText)
|
|
|
+ {
|
|
|
+ if ((contentEditType & CPDFEditType.EditText) == CPDFEditType.EditText)
|
|
|
+ {
|
|
|
+ rect = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (editArea.Type == CPDFEditType.EditImage)
|
|
|
{
|
|
|
if ((contentEditType & CPDFEditType.EditImage) == CPDFEditType.EditImage)
|
|
|
{
|
|
|
rect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditImageArea).GetClipRect());
|
|
|
}
|
|
|
}
|
|
|
+ else if (editArea.Type == CPDFEditType.EditPath)
|
|
|
+ {
|
|
|
+ if ((contentEditType & CPDFEditType.EditPath) == CPDFEditType.EditPath)
|
|
|
+ {
|
|
|
+ rect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditPathArea).GetClipRect());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
rect.X = (rect.X) * currentZoom;
|
|
|
rect.Y = (rect.Y) * currentZoom;
|
|
@@ -2003,7 +2132,6 @@ namespace ComPDFKit.Tool
|
|
|
caretVisual.StopCaret();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// Jump cursor to a specific position in a text area.
|
|
|
/// </summary>
|
|
@@ -2174,61 +2302,89 @@ namespace ComPDFKit.Tool
|
|
|
/// <param name="rectFrameSelect"></param>
|
|
|
public void FrameSelectAddRect(Rect rectFrameSelect)
|
|
|
{
|
|
|
- if (rectFrameSelect.Width == 0 || rectFrameSelect.Height == 0)
|
|
|
- {
|
|
|
+ if (rectFrameSelect.Width == 0 || rectFrameSelect.Height == 0 || PDFViewer.CurrentRenderFrame == null)
|
|
|
return;
|
|
|
- }
|
|
|
- if (PDFViewer.CurrentRenderFrame == null)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
+
|
|
|
RenderFrame currentRenderFrame = PDFViewer.CurrentRenderFrame;
|
|
|
BaseLayer customizeLayer = PDFViewer.GetViewForTag(textEditTag);
|
|
|
-
|
|
|
customizeLayer.Children.Clear();
|
|
|
CaretVisual caretVisual = new CaretVisual(GetDefaultDrawParam());
|
|
|
customizeLayer.Children.Add(caretVisual);
|
|
|
|
|
|
- currentZoom = currentRenderFrame.ZoomFactor;
|
|
|
MultiSelectedRect multiSelectedRect = CommonHelper.FindVisualChild<MultiSelectedRect>(PDFViewer.GetViewForTag(MultiSelectedRectViewTag));
|
|
|
foreach (RenderData item in currentRenderFrame.GetRenderDatas())
|
|
|
{
|
|
|
- if (item.PageIndex == FrameSelectPageIndex)
|
|
|
+ if (item.PageIndex == FrameSelectPageIndex && item.CPDFEditPageObj != null)
|
|
|
{
|
|
|
- if (item.CPDFEditPageObj == null)
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
foreach (CPDFEditArea editArea in item.CPDFEditPageObj.GetEditAreaList())
|
|
|
{
|
|
|
- Rect TextBlock = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
|
|
|
+ Rect editAreaRect = new Rect();
|
|
|
if (editArea.Type == CPDFEditType.EditImage)
|
|
|
{
|
|
|
if ((contentEditType & CPDFEditType.EditImage) != CPDFEditType.EditImage)
|
|
|
- {
|
|
|
continue;
|
|
|
- }
|
|
|
- TextBlock = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditImageArea).GetClipRect());
|
|
|
+
|
|
|
+ editAreaRect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditImageArea).GetClipRect());
|
|
|
}
|
|
|
else if (editArea.Type == CPDFEditType.EditText)
|
|
|
{
|
|
|
if ((contentEditType & CPDFEditType.EditText) != CPDFEditType.EditText)
|
|
|
- {
|
|
|
continue;
|
|
|
- }
|
|
|
+
|
|
|
+ editAreaRect = DataConversionForWPF.CRectConversionForRect(editArea.GetFrame());
|
|
|
}
|
|
|
- Rect rect = TextBlock;
|
|
|
- if (rectFrameSelect.IntersectsWith(rect))
|
|
|
+ else if (editArea.Type == CPDFEditType.EditPath)
|
|
|
{
|
|
|
- SelectedRect selectedRects = GetSelectedRectForEditAreaObject(editArea);
|
|
|
+ if ((contentEditType & CPDFEditType.EditPath) != CPDFEditType.EditPath)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ editAreaRect = DataConversionForWPF.CRectConversionForRect((editArea as CPDFEditPathArea).GetClipRect());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (rectFrameSelect.IntersectsWith(editAreaRect))
|
|
|
+ {
|
|
|
+ SelectedRect editAreaSelectedRect = GetSelectedRectForEditAreaObject(editArea);
|
|
|
+ if(editAreaSelectedRect == null && editArea is CPDFEditPathArea)
|
|
|
+ {
|
|
|
+ cachePathList.Add(editArea as CPDFEditPathArea);
|
|
|
+
|
|
|
+ editAreaRect.X = (editAreaRect.X) * currentZoom;
|
|
|
+ editAreaRect.Y = (editAreaRect.Y) * currentZoom;
|
|
|
+ editAreaRect.Width *= currentZoom;
|
|
|
+ editAreaRect.Height *= currentZoom;
|
|
|
+ editAreaRect = DpiHelper.PDFRectToStandardRect(editAreaRect);
|
|
|
+ editAreaRect.X += item.PageBound.X;
|
|
|
+ editAreaRect.Y += item.PageBound.Y;
|
|
|
+
|
|
|
+ editAreaSelectedRect = new SelectedRect(GetDefaultDrawParam(), SelectedType.PDFEdit);
|
|
|
+ editAreaSelectedRect.SetEditPen(editPen, editHoverPen);
|
|
|
+ editAreaSelectedRect.SetDrawMoveType(DrawMoveType.kReferenceLine);
|
|
|
+ customizeLayer.Children.Add(editAreaSelectedRect);
|
|
|
+
|
|
|
+ editAreaSelectedRect.SetRectPadding(5);
|
|
|
+ editAreaSelectedRect.SetRect(editAreaRect, currentZoom);
|
|
|
+ editAreaSelectedRect.SetMaxRect(item.PageBound);
|
|
|
+ editAreaSelectedRect.SetIgnorePointsAll();
|
|
|
+
|
|
|
+ EditAreaObject editAreaObjects = new EditAreaObject();
|
|
|
+ editAreaObjects.ControlType = PointControlType.None;
|
|
|
+ editAreaObjects.cPDFEditArea = editArea;
|
|
|
+ editAreaObjects.cPDFEditPage = item.CPDFEditPageObj;
|
|
|
+ editAreaObjects.PageIndex = item.PageIndex;
|
|
|
+ editAreaObjects.EditAreaIndex = item.CPDFEditPageObj.GetEditAreaList().IndexOf(editArea);
|
|
|
+ editAreaObjects.PageBound = item.PageBound;
|
|
|
+ editAreaObjects.PaintRect = item.PaintRect;
|
|
|
+
|
|
|
+ this.editArea.Add(editAreaSelectedRect, editAreaObjects);
|
|
|
+ }
|
|
|
SelectedRect selectedRect = new SelectedRect(GetDefaultDrawParam(), SelectedType.PDFEdit);
|
|
|
selectedRect.SetEditPen(editPen, editHoverPen);
|
|
|
multiSelectedRect.SetSelectedType(SelectedType.PDFEdit);
|
|
|
selectedRect.SetDrawMoveType(DrawMoveType.kReferenceLine);
|
|
|
- selectedRect.SetRect(selectedRects.GetRect(), currentZoom);
|
|
|
- selectedRect.SetMaxRect(selectedRects.GetMaxRect());
|
|
|
- EditAreaObject editAreaObject = null;
|
|
|
+ selectedRect.SetRect(editAreaSelectedRect.GetRect(), currentZoom);
|
|
|
+ selectedRect.SetMaxRect(editAreaSelectedRect.GetMaxRect());
|
|
|
|
|
|
+ EditAreaObject editAreaObject = null;
|
|
|
foreach (var eitem in this.editArea)
|
|
|
{
|
|
|
if (eitem.Value.cPDFEditArea == editArea)
|
|
@@ -2237,35 +2393,35 @@ namespace ComPDFKit.Tool
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
int pageIndex = editAreaObject.PageIndex;
|
|
|
if (multiPage != pageIndex && editAreaList.Count > 0)
|
|
|
{
|
|
|
foreach (int itemIndex in editAreaMultiIndex)
|
|
|
{
|
|
|
- SelectedRect OldRect = GetEditAreaForIndex(multiPage, itemIndex);
|
|
|
- if (OldRect != null)
|
|
|
- {
|
|
|
- OldRect.Draw();
|
|
|
- }
|
|
|
+ SelectedRect oldRect = GetEditAreaForIndex(multiPage, itemIndex);
|
|
|
+ oldRect?.Draw();
|
|
|
}
|
|
|
+
|
|
|
editAreaMultiIndex.Clear();
|
|
|
multiSelectedRect.ClearDraw();
|
|
|
multiSelectedRect.CleanMulitSelectedRect();
|
|
|
- multiPage = pageIndex;
|
|
|
}
|
|
|
- multiPage = editAreaObject.PageIndex;
|
|
|
+
|
|
|
+ multiPage = pageIndex;
|
|
|
editAreaMultiIndex.Add(editAreaObject.EditAreaIndex);
|
|
|
editAreaList.Add(selectedRect, editAreaObject);
|
|
|
multiSelectedRect.Children.Add(selectedRect);
|
|
|
multiSelectedRect.SetMulitSelectedRect(selectedRect, editAreaObject.PageIndex, editAreaObject.EditAreaIndex);
|
|
|
|
|
|
- multiSelectedRect.SetRect(selectedRects.GetRect());
|
|
|
- multiSelectedRect.SetMaxRect(selectedRects.GetMaxRect());
|
|
|
+ multiSelectedRect.SetRect(editAreaSelectedRect.GetRect());
|
|
|
+ multiSelectedRect.SetMaxRect(editAreaSelectedRect.GetMaxRect());
|
|
|
multiSelectedRect.Draw();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
PDFViewer.UpdateRenderFrame();
|
|
|
}
|
|
|
|
|
@@ -2362,7 +2518,7 @@ namespace ComPDFKit.Tool
|
|
|
CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
|
|
|
CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
|
|
|
CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
|
|
|
- cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
+ cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
|
|
|
foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
|
|
|
{
|
|
|
SelectedRect item = checkItem;
|
|
@@ -2422,7 +2578,7 @@ namespace ComPDFKit.Tool
|
|
|
CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
|
|
|
CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
|
|
|
CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
|
|
|
- cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
+ cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
|
|
|
foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
|
|
|
{
|
|
|
SelectedRect item = checkItem;
|
|
@@ -2495,7 +2651,7 @@ namespace ComPDFKit.Tool
|
|
|
CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
|
|
|
CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
|
|
|
CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
|
|
|
- cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
+ cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
|
|
|
foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
|
|
|
{
|
|
|
SelectedRect item = checkItem;
|
|
@@ -2570,7 +2726,7 @@ namespace ComPDFKit.Tool
|
|
|
CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
|
|
|
CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
|
|
|
CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
|
|
|
- cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
+ cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
|
|
|
foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
|
|
|
{
|
|
|
SelectedRect item = checkItem;
|
|
@@ -2630,7 +2786,7 @@ namespace ComPDFKit.Tool
|
|
|
CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
|
|
|
CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
|
|
|
CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
|
|
|
- cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
+ cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
|
|
|
foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
|
|
|
{
|
|
|
SelectedRect item = checkItem;
|
|
@@ -2687,7 +2843,7 @@ namespace ComPDFKit.Tool
|
|
|
CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
|
|
|
CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
|
|
|
CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
|
|
|
- cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
+ cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
|
|
|
foreach (SelectedRect checkItem in MultiSelectEditList.GetMulitSelectList())
|
|
|
{
|
|
|
SelectedRect item = checkItem;
|
|
@@ -2746,7 +2902,7 @@ namespace ComPDFKit.Tool
|
|
|
CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
|
|
|
CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
|
|
|
CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
|
|
|
- cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
+ cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
|
|
|
foreach (SelectedRect item in MultiSelectEditList.GetMulitSelectList())
|
|
|
{
|
|
|
Rect rect = item.GetRect();
|
|
@@ -2809,7 +2965,7 @@ namespace ComPDFKit.Tool
|
|
|
CPDFDocument cPDFDocument = GetCPDFViewer().GetDocument();
|
|
|
CPDFPage cPDFPage = cPDFDocument.PageAtIndex(multiPage);
|
|
|
CPDFEditPage cPDFEditPage = cPDFPage.GetEditPage();
|
|
|
- cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
+ cPDFEditPage.BeginEdit(CPDFEditType.EditText | CPDFEditType.EditImage | CPDFEditType.EditPath);
|
|
|
foreach (SelectedRect item in MultiSelectEditList.GetMulitSelectList())
|
|
|
{
|
|
|
Rect rect = item.GetRect();
|