|
@@ -1170,11 +1170,13 @@ namespace PDF_Master.ViewModels.Tools
|
|
AnnotationContent annotation = null;
|
|
AnnotationContent annotation = null;
|
|
//OpenBOTA关闭时也要进入
|
|
//OpenBOTA关闭时也要进入
|
|
//if (viewContentViewModel.OpenBOTA == false)
|
|
//if (viewContentViewModel.OpenBOTA == false)
|
|
- {
|
|
|
|
- viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out annotation);
|
|
|
|
- }
|
|
|
|
|
|
+ //{
|
|
|
|
+ viewModel = GetAnnotationContentViewModel(bOTAContentViewModel, out annotation);
|
|
|
|
+ //}
|
|
bool isMultiple = false;
|
|
bool isMultiple = false;
|
|
Dictionary<int, List<int>> selectAnnotDicts = new Dictionary<int, List<int>>();
|
|
Dictionary<int, List<int>> selectAnnotDicts = new Dictionary<int, List<int>>();
|
|
|
|
+ Dictionary<int, List<int>> selectFreehandDicts = new Dictionary<int, List<int>>();
|
|
|
|
+
|
|
if (e != null && e.Count > 0)
|
|
if (e != null && e.Count > 0)
|
|
{
|
|
{
|
|
for (int i = 0; i < e.Count; i++)
|
|
for (int i = 0; i < e.Count; i++)
|
|
@@ -1232,7 +1234,7 @@ namespace PDF_Master.ViewModels.Tools
|
|
annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
|
|
annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
|
|
annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp
|
|
annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp
|
|
|
|
|
|
- /*|| annot.EventType == AnnotArgsType.AnnotSticky ||annot.EventType == AnnotArgsType.AnnotFreeText || annot.EventType == AnnotArgsType.AnnotFreehand*/)
|
|
|
|
|
|
+ /*|| annot.EventType == AnnotArgsType.AnnotSticky ||annot.EventType == AnnotArgsType.AnnotFreeText */)
|
|
{
|
|
{
|
|
if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
|
|
if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
|
|
{
|
|
{
|
|
@@ -1245,6 +1247,20 @@ namespace PDF_Master.ViewModels.Tools
|
|
}
|
|
}
|
|
isMultiple = true;
|
|
isMultiple = true;
|
|
}
|
|
}
|
|
|
|
+ //添加后不选中的注释,需要额外处理
|
|
|
|
+ if (annot.EventType == AnnotArgsType.AnnotFreehand || annot.EventType == AnnotArgsType.AnnotSticky || annot.EventType == AnnotArgsType.AnnotFreeText)
|
|
|
|
+ {
|
|
|
|
+ if (selectFreehandDicts.ContainsKey(editEvent.PageIndex) == false)
|
|
|
|
+ {
|
|
|
|
+ selectFreehandDicts.Add(editEvent.PageIndex, new List<int>());
|
|
|
|
+ selectFreehandDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ selectFreehandDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
|
|
|
|
+ }
|
|
|
|
+ isMultiple = true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1351,19 +1367,8 @@ namespace PDF_Master.ViewModels.Tools
|
|
}
|
|
}
|
|
}
|
|
}
|
|
IsPasteShape = false;
|
|
IsPasteShape = false;
|
|
- if (isMultiple && selectAnnotDicts.Count >= 1)
|
|
|
|
- {
|
|
|
|
- //PDFViewer.DisableClearSelectAnnot(false);
|
|
|
|
- PDFViewer.ClearSelectAnnots();
|
|
|
|
|
|
|
|
- if (StrAnnotToolChecked != "Signature")
|
|
|
|
- {
|
|
|
|
- //PDFViewer.DisableClearSelectAnnot(true);
|
|
|
|
- PDFViewer.SelectAnnotation(selectAnnotDicts);
|
|
|
|
- //禁止取消选中注释
|
|
|
|
- //PDFViewer.DisableClearSelectAnnot(false);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ SetMultipleAnnot(isMultiple, selectAnnotDicts, selectFreehandDicts);
|
|
//MultipleSelectionAnnot(e);
|
|
//MultipleSelectionAnnot(e);
|
|
//空白处 右键菜单 添加注释 为单次添加,不连续添加
|
|
//空白处 右键菜单 添加注释 为单次添加,不连续添加
|
|
if (IsNoSelectMenu && PropertyPanel.IsAddLink == false)
|
|
if (IsNoSelectMenu && PropertyPanel.IsAddLink == false)
|
|
@@ -1379,6 +1384,101 @@ namespace PDF_Master.ViewModels.Tools
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 设置多选注释
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="isMultiple"></param>
|
|
|
|
+ /// <param name="selectAnnotDicts">添加后选中的注释</param>
|
|
|
|
+ /// <param name="selectFreehandDicts">添加后不选中的注释,需要额外处理</param>
|
|
|
|
+ private void SetMultipleAnnot(bool isMultiple, Dictionary<int, List<int>> selectAnnotDicts, Dictionary<int, List<int>> selectFreehandDicts)
|
|
|
|
+ {
|
|
|
|
+ if (isMultiple)
|
|
|
|
+ {
|
|
|
|
+ Dictionary<int, List<int>> dict = new Dictionary<int, List<int>>();
|
|
|
|
+ //阅读页多选注释,只能在当前页多选,不可以跨页多选
|
|
|
|
+ if (selectAnnotDicts.Count >= 1)
|
|
|
|
+ {
|
|
|
|
+ PDFViewer.ClearSelectAnnots();
|
|
|
|
+ //if (StrAnnotToolChecked != "Signature")
|
|
|
|
+ //{
|
|
|
|
+ PDFViewer.SelectAnnotation(selectAnnotDicts);
|
|
|
|
+
|
|
|
|
+ if (selectFreehandDicts.Count >= 1)
|
|
|
|
+ {
|
|
|
|
+ if (selectFreehandDicts.FirstOrDefault().Value.Count > 1)
|
|
|
|
+ {
|
|
|
|
+ //先把键都合并到dict中,值都是新创建的
|
|
|
|
+ foreach (var key in selectAnnotDicts.Keys)
|
|
|
|
+ {
|
|
|
|
+ if (!dict.ContainsKey(key))
|
|
|
|
+ {
|
|
|
|
+ dict.Add(key, new List<int>());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach (var key in selectFreehandDicts.Keys)
|
|
|
|
+ {
|
|
|
|
+ if (!dict.ContainsKey(key))
|
|
|
|
+ {
|
|
|
|
+ dict.Add(key, new List<int>());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //分别将值添加进去
|
|
|
|
+ foreach (var ele in selectAnnotDicts)
|
|
|
|
+ {
|
|
|
|
+ dict[ele.Key].AddRange(ele.Value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach (var ele in selectFreehandDicts)
|
|
|
|
+ {
|
|
|
|
+ dict[ele.Key].AddRange(ele.Value);
|
|
|
|
+ }
|
|
|
|
+ //Dictionary<int, List<int>> items2 = selectAnnotDicts.Union(selectFreehandDicts).ToDictionary(k => k.Key, v => v.Value);
|
|
|
|
+
|
|
|
|
+ PDFViewer.ClearSelectAnnots();
|
|
|
|
+ PDFViewer.SelectAnnotation(dict);
|
|
|
|
+ }
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (selectFreehandDicts.Count >= 1)
|
|
|
|
+ {
|
|
|
|
+ if (selectFreehandDicts.FirstOrDefault().Value.Count > 1)
|
|
|
|
+ {
|
|
|
|
+ PDFViewer.ClearSelectAnnots();
|
|
|
|
+ PDFViewer.SelectAnnotation(selectFreehandDicts);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ #region 之前版本
|
|
|
|
+ //if (isMultiple && selectAnnotDicts.Count >= 1)
|
|
|
|
+ //{
|
|
|
|
+ // //PDFViewer.DisableClearSelectAnnot(false);
|
|
|
|
+ // PDFViewer.ClearSelectAnnots();
|
|
|
|
+
|
|
|
|
+ // if (StrAnnotToolChecked != "Signature")
|
|
|
|
+ // {
|
|
|
|
+ // //PDFViewer.DisableClearSelectAnnot(true);
|
|
|
|
+ // PDFViewer.SelectAnnotation(selectAnnotDicts);
|
|
|
|
+ // //禁止取消选中注释
|
|
|
|
+ // //PDFViewer.DisableClearSelectAnnot(false);
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+ //if (isMultiple && selectFreehandDicts.Count >= 1)
|
|
|
|
+ //{
|
|
|
|
+ // PDFViewer.ClearSelectAnnots();
|
|
|
|
+ // if (selectFreehandDicts.FirstOrDefault().Value.Count >= 1)
|
|
|
|
+ // {
|
|
|
|
+ // PDFViewer.SelectAnnotation(selectFreehandDicts);
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+ #endregion
|
|
|
|
+ }
|
|
|
|
+
|
|
//复制多个注释,粘贴后,默认注释未选中状态
|
|
//复制多个注释,粘贴后,默认注释未选中状态
|
|
private void MultipleSelectionAnnot(List<AnnotEditEvent> e)
|
|
private void MultipleSelectionAnnot(List<AnnotEditEvent> e)
|
|
{
|
|
{
|