|
@@ -26,6 +26,7 @@ using Prism.Regions;
|
|
|
using Prism.Services.Dialogs;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Diagnostics;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Reflection;
|
|
@@ -433,6 +434,8 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
}
|
|
|
if (annotHandler != null)
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
//是否展开右侧面板 =>否(链接、图章、签名除外)
|
|
|
if (str == AddAnnotType.AnnotLink.ToString()
|
|
|
|| str == AddAnnotType.AnnotStamp.ToString()
|
|
@@ -1072,6 +1075,7 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
};
|
|
|
|
|
|
PDFViewer.SetToolParam(annotArgs);
|
|
|
+
|
|
|
}
|
|
|
else if (annot is FreeTextAnnotArgs freeText)
|
|
|
{
|
|
@@ -1623,25 +1627,82 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
|
|
|
private void ShortCut_KeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
- if (KeyEventsHelper.IsSingleKey(Key.Escape))
|
|
|
+ //之前取消逻辑
|
|
|
+
|
|
|
+ // if (KeyEventsHelper.IsSingleKey(Key.Escape))
|
|
|
+ // {
|
|
|
+ // if (StrAnnotToolChecked != "Freetext")
|
|
|
+ // {
|
|
|
+ // ExitAnnotationTool();
|
|
|
+ // }
|
|
|
+ // else if (StrAnnotToolChecked == "Freetext")
|
|
|
+ // {
|
|
|
+ // if (PDFViewer.ToolManager.CurrentAnnotArgs is FreeTextAnnotArgs textAnnotArgs)
|
|
|
+ // {
|
|
|
+ // if (PDFViewer.ToolManager.HasTool)
|
|
|
+ // {
|
|
|
+ // PDFViewer.RemoveTool(true);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // ExitAnnotationTool();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+
|
|
|
+ if (e.Key == Key.Escape && PDFViewer.MouseMode == MouseModes.AnnotCreate)
|
|
|
{
|
|
|
- if (StrAnnotToolChecked != "Freetext")
|
|
|
- {
|
|
|
- ExitAnnotationTool();
|
|
|
- }
|
|
|
- else if (StrAnnotToolChecked == "Freetext")
|
|
|
- {
|
|
|
- if (PDFViewer.ToolManager.CurrentAnnotArgs is FreeTextAnnotArgs textAnnotArgs)
|
|
|
- {
|
|
|
- if (PDFViewer.ToolManager.HasTool)
|
|
|
- {
|
|
|
- PDFViewer.RemoveTool(true);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ExitAnnotationTool();
|
|
|
- }
|
|
|
+ if (PDFViewer.ToolManager != null && PDFViewer.ToolManager.CurrentAnnotArgs != null)
|
|
|
+ {
|
|
|
+ AnnotHandlerEventArgs annotArgs = PDFViewer.ToolManager.CurrentAnnotArgs;
|
|
|
+ switch (annotArgs.EventType)
|
|
|
+ {
|
|
|
+ case AnnotArgsType.AnnotLine:
|
|
|
+ case AnnotArgsType.AnnotSquare:
|
|
|
+ case AnnotArgsType.AnnotCircle:
|
|
|
+ case AnnotArgsType.AnnotHighlight:
|
|
|
+ case AnnotArgsType.AnnotUnderline:
|
|
|
+ case AnnotArgsType.AnnotStrikeout:
|
|
|
+ case AnnotArgsType.AnnotStamp:
|
|
|
+ case AnnotArgsType.AnnotLink:
|
|
|
+ case AnnotArgsType.AnnotFreehand:
|
|
|
+ case AnnotArgsType.AnnotSticky:
|
|
|
+ Trace.WriteLine(StrAnnotToolChecked);
|
|
|
+ if (PDFViewer.ToolManager.HasTool)
|
|
|
+ {
|
|
|
+ PDFViewer.RemoveTool(false);
|
|
|
+ }
|
|
|
+ else{ExitAnnotationTool();}
|
|
|
+ break;
|
|
|
+ case AnnotArgsType.AnnotFreeText:
|
|
|
+ {
|
|
|
+ //if (StrAnnotToolChecked != "Freetext")
|
|
|
+ //{
|
|
|
+ // ExitAnnotationTool();
|
|
|
+ //}
|
|
|
+ //else if (StrAnnotToolChecked == "Freetext")
|
|
|
+ {
|
|
|
+ if (PDFViewer.ToolManager.CurrentAnnotArgs is FreeTextAnnotArgs textAnnotArgs)
|
|
|
+ {
|
|
|
+ if (PDFViewer.ToolManager.HasTool)
|
|
|
+ {
|
|
|
+ PDFViewer.RemoveTool(true);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ExitAnnotationTool();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
else if (KeyEventsHelper.IsModifierKey(ModifierKeys.Shift, Key.None))
|
|
@@ -1649,6 +1710,7 @@ namespace PDF_Master.ViewModels.Tools
|
|
|
//按住Shift等比缩放
|
|
|
}
|
|
|
|
|
|
+
|
|
|
AnnotToolCtrlAltKey();
|
|
|
}
|
|
|
|