123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557 |
- using ComPDFKit.PDFAnnotation;
- using ComPDFKit.PDFAnnotation.Form;
- using ComPDFKit.PDFDocument;
- using ComPDFKit.Tool;
- using ComPDFKit.Tool.SettingParam;
- using Compdfkit_Tools.PDFControlUI;
- using ComPDFKitViewer;
- using ComPDFKitViewer.BaseObject;
- using ComPDFKitViewer.Widget;
- using Nager.Country.Currencies;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Reflection;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using Compdfkit_Tools.Helper;
- using ComPDFKit.Tool.DrawTool;
- using static ComPDFKit.Tool.CPDFToolManager;
- using static Compdfkit_Tools.PDFControlUI.CPDFViewModeUI;
- using SplitMode = Compdfkit_Tools.PDFControlUI.CPDFViewModeUI.SplitMode;
- namespace Compdfkit_Tools.PDFControl
- {
- public partial class PDFViewControl : UserControl
- {
- private CPDFViewerTool splitViewerTool;
- private CPDFToolManager splitToolManager;
- private CPDFViewerTool viewerTool;
- private CPDFToolManager toolManager;
- public CPDFViewerTool PDFViewTool { get; private set; }
- public CPDFToolManager PDFToolManager { get; private set; }
- public CPDFViewerTool FocusPDFViewTool { get; private set; }
- //public event EventHandler SplitPDFViewToolCreated;
- public event EventHandler FocusPDFViewToolChanged;
- public event EventHandler<MouseEventObject> MouseLeftButtonDownHandler;
- public event EventHandler<MouseEventObject> MouseLeftButtonUpHandler;
- public event EventHandler<MouseEventObject> MouseMoveHandler;
- public event EventHandler<MouseEventObject> MouseRightButtonDownHandler;
- public event EventHandler<ComPDFKitViewer.MouseWheelZoomArgs> MouseWheelZoomHandler;
- public event EventHandler DrawChanged;
- //private ContextMenu RightMenu;
- #region Properties
- private double splitWidthScale = 0.5;
- private double splitHeightScale = 0.5;
- public bool CustomSignHandle { get; set; }
- private double[] zoomLevelList = { 1f, 8f, 12f, 25, 33f, 50, 66f, 75, 100, 125, 150, 200, 300, 400, 600, 800, 1000 };
- #endregion
- public PDFViewControl()
- {
- InitializeComponent();
- viewerTool = new CPDFViewerTool();
- toolManager = new CPDFToolManager(viewerTool);
- Loaded += PDFViewControl_Loaded;
- PDFViewTool = viewerTool;
- PDFToolManager = toolManager;
- PDFToolManager.SetToolType(CPDFToolManager.ToolType.Viewer);
- splitViewerTool = new CPDFViewerTool();
- splitToolManager = new CPDFToolManager(splitViewerTool);
- splitToolManager.SetToolType(CPDFToolManager.ToolType.Viewer);
- FocusPDFViewTool = viewerTool;
- PDFView.Child = PDFViewTool;
- VerticalView.Child = splitViewerTool;
- PDFViewTool.SizeChanged -= PDFViewTool_SizeChanged;
- PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler -= PDFViewControl_MouseWheelZoomHandler;
- PDFViewTool.DrawChanged -= PDFViewTool_DrawChanged;
- PDFToolManager.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
- PDFToolManager.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
- PDFToolManager.MouseMoveHandler -= PDFToolManager_MouseMoveHandler;
- PDFToolManager.AnnotDefaultEditedHandler -= PDFToolManager_AnnotDefaultEditedHandler;
- PDFToolManager.MouseRightButtonDownHandler -= PDFToolManager_MouseRightButtonDownHandler;
- PDFViewTool.SizeChanged += PDFViewTool_SizeChanged;
- PDFViewTool.GetCPDFViewer().MouseWheelZoomHandler += PDFViewControl_MouseWheelZoomHandler;
- PDFViewTool.DrawChanged += PDFViewTool_DrawChanged;
- PDFToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
- PDFToolManager.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
- PDFToolManager.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
- PDFToolManager.AnnotDefaultEditedHandler += PDFToolManager_AnnotDefaultEditedHandler;
- PDFToolManager.MouseRightButtonDownHandler += PDFToolManager_MouseRightButtonDownHandler;
- splitViewerTool.SizeChanged -= SplitViewerTool_SizeChanged;
- splitViewerTool.GetCPDFViewer().MouseWheelZoomHandler -= SplitPDFViewControl_MouseWheelZoomHandler;
- splitViewerTool.DrawChanged -= PDFViewTool_DrawChanged;
- splitToolManager.MouseLeftButtonDownHandler -= PDFToolManager_MouseLeftButtonDownHandler;
- splitToolManager.MouseLeftButtonUpHandler -= PDFToolManager_MouseLeftButtonUpHandler;
- splitToolManager.MouseMoveHandler -= PDFToolManager_MouseMoveHandler;
- splitToolManager.AnnotDefaultEditedHandler -= PDFToolManager_AnnotDefaultEditedHandler;
- splitToolManager.MouseRightButtonDownHandler -= PDFToolManager_MouseRightButtonDownHandler;
- splitViewerTool.SizeChanged += SplitViewerTool_SizeChanged;
- splitViewerTool.GetCPDFViewer().MouseWheelZoomHandler += SplitPDFViewControl_MouseWheelZoomHandler;
- splitViewerTool.DrawChanged += PDFViewTool_DrawChanged;
- splitToolManager.MouseLeftButtonDownHandler += PDFToolManager_MouseLeftButtonDownHandler;
- splitToolManager.MouseLeftButtonUpHandler += PDFToolManager_MouseLeftButtonUpHandler;
- splitToolManager.MouseMoveHandler += PDFToolManager_MouseMoveHandler;
- splitToolManager.AnnotDefaultEditedHandler += PDFToolManager_AnnotDefaultEditedHandler;
- splitToolManager.MouseRightButtonDownHandler += PDFToolManager_MouseRightButtonDownHandler;
- }
- private void PDFToolManager_AnnotDefaultEditedHandler(object sender, SelectedAnnotData e)
- {
- UpdateAnnotFrame();
- }
- private void PDFViewControl_Loaded(object sender, RoutedEventArgs e)
- {
- RemoveSplitViewerTool();
- }
- private void PDFViewTool_DrawChanged(object sender, EventArgs e)
- {
- DrawChanged?.Invoke(sender, e);
- }
- public ContextMenu GetRightMenu()
- {
- FocusPDFViewTool.ContextMenu?.Items.Clear();
- return FocusPDFViewTool.ContextMenu;
- }
- public void SetRightMenu(ContextMenu contextMenu)
- {
- FocusPDFViewTool.ContextMenu = contextMenu;
- }
- private void PDFToolManager_MouseRightButtonDownHandler(object sender, MouseEventObject e)
- {
- Point point = e.mouseButtonEventArgs.GetPosition(this);
- viewerTool.GetCPDFViewer().GetPointPageInfo(point, out int index, out Rect paintRect, out Rect pageBound);
- if(index == -1)
- {
- viewerTool.ContextMenu = null;
- return;
- }
- PDFViewTool.SetPastePoint(point);
- MouseRightButtonDownHandler?.Invoke(sender, e);
- }
- private void PDFToolManager_MouseMoveHandler(object sender, MouseEventObject e)
- {
- MouseMoveHandler?.Invoke(this, e);
- }
- private void PDFToolManager_MouseLeftButtonUpHandler(object sender, MouseEventObject e)
- {
- MouseLeftButtonUpHandler?.Invoke(sender, e);
- }
- private void PDFToolManager_MouseLeftButtonDownHandler(object sender, MouseEventObject e)
- {
- MouseLeftButtonDownHandler?.Invoke(sender, e);
- }
- private void PDFViewTool_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- PDFViewTool.GetCPDFViewer().UpdateRenderFrame();
- }
- private void SplitViewerTool_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- if (VerticalView.Visibility == Visibility.Visible)
- {
- splitWidthScale = VerticalView.ActualWidth / ViewToolGrid.ActualWidth;
- }
- if (HorizontalView.Visibility == Visibility.Visible)
- {
- splitHeightScale = HorizontalView.ActualHeight / ViewToolGrid.ActualHeight;
- }
- splitViewerTool.GetCPDFViewer().UpdateRenderFrame();
- }
- public void InitDocument(string Path)
- {
- CPDFDocument pdfDoc = CPDFDocument.InitWithFilePath(Path);
- if (pdfDoc != null)
- {
- PDFViewTool.GetCPDFViewer().InitDoc(pdfDoc);
- PDFViewTool.GetCPDFViewer().SetFitMode(FitMode.FitHeight);
- PDFViewTool.GetCPDFViewer().SetViewMode(ViewMode.SingleContinuous);
- splitViewerTool.GetCPDFViewer().InitDoc(pdfDoc);
- splitViewerTool.GetCPDFViewer().SetFitMode(FitMode.FitHeight);
- splitViewerTool.GetCPDFViewer().SetViewMode(ViewMode.SingleContinuous);
- }
- }
- private void PDFViewControl_MouseWheelZoomHandler(object sender, ComPDFKitViewer.MouseWheelZoomArgs e)
- {
- FocusPDFViewTool = PDFViewTool;
- FocusPDFViewToolChanged?.Invoke(this, EventArgs.Empty);
- if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
- {
- e.IsZoom = true;
- PDFViewTool.GetCPDFViewer().SetFitMode(FitMode.FitZoom);
- double zoom = PDFViewTool.GetCPDFViewer().GetZoom();
- PDFViewTool.GetCPDFViewer().SetZoom(CheckZoomLevel(zoom, Convert.ToBoolean(e.WheelBehavior)));
- PDFViewTool?.GetCPDFViewer()?.UpdateRenderFrame();
- }
- MouseWheelZoomHandler?.Invoke(this, e);
- }
- private void SplitPDFViewControl_MouseWheelZoomHandler(object sender, ComPDFKitViewer.MouseWheelZoomArgs e)
- {
- FocusPDFViewTool = splitViewerTool;
- FocusPDFViewToolChanged?.Invoke(this, EventArgs.Empty);
- if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
- {
- e.IsZoom = true;
- splitViewerTool.GetCPDFViewer().SetFitMode(FitMode.FitZoom);
- double zoom = splitViewerTool.GetCPDFViewer().GetZoom();
- splitViewerTool.GetCPDFViewer().SetZoom(CheckZoomLevel(zoom, Convert.ToBoolean(e.WheelBehavior)));
- splitViewerTool?.GetCPDFViewer()?.UpdateRenderFrame();
- }
- MouseWheelZoomHandler?.Invoke(this, e);
- }
- public void SetSplitViewMode(SplitMode splitMode)
- {
- switch (splitMode)
- {
- case SplitMode.None:
- RemoveSplitViewerTool();
- break;
- case SplitMode.Vertical:
- RemoveSplitViewerTool();
- if (splitViewerTool != null)
- {
- VerticalSplitter.Visibility = Visibility.Visible;
- VerticalView.Visibility = Visibility.Visible;
- ViewToolGrid.ColumnDefinitions[1].Width = new GridLength(15, GridUnitType.Auto);
- ViewToolGrid.ColumnDefinitions[2].Width = new GridLength(ViewToolGrid.ActualWidth / 2);
- VerticalView.Child = splitViewerTool;
- }
- break;
- case SplitMode.Horizontal:
- RemoveSplitViewerTool();
- if (splitViewerTool != null)
- {
- HorizontalSplitter.Visibility = Visibility.Visible;
- HorizontalView.Visibility = Visibility.Visible;
- ViewToolGrid.RowDefinitions[1].Height = new GridLength(15, GridUnitType.Auto);
- ViewToolGrid.RowDefinitions[2].Height = new GridLength(ViewToolGrid.ActualHeight / 2);
- HorizontalView.Child = splitViewerTool;
- }
- break;
- }
- UpdateRenderFrame();
- UpdateAnnotFrame();
- }
- public void UpdateRenderFrame()
- {
- viewerTool?.GetCPDFViewer()?.UpdateRenderFrame();
- splitViewerTool?.GetCPDFViewer()?.UpdateRenderFrame();
- }
- public void UpdateAnnotFrame()
- {
- viewerTool?.GetCPDFViewer()?.UpdateAnnotFrame();
- splitViewerTool?.GetCPDFViewer()?.UpdateAnnotFrame();
- }
- public void SetCropMode(bool isCrop)
- {
- viewerTool?.GetCPDFViewer()?.SetIsCrop(isCrop);
- splitViewerTool?.GetCPDFViewer()?.SetIsCrop(isCrop);
- viewerTool?.GetCPDFViewer()?.UpdateVirtualNodes();
- splitViewerTool?.GetCPDFViewer()?.UpdateVirtualNodes();
- viewerTool?.GetCPDFViewer()?.UpdateRenderFrame();
- splitViewerTool?.GetCPDFViewer()?.UpdateRenderFrame();
- }
- public void SetToolType(ToolType type)
- {
- toolManager?.SetToolType(type);
- splitToolManager?.SetToolType(type);
- }
- public void SetCreateAnnotType(C_ANNOTATION_TYPE type)
- {
- toolManager?.SetCreateAnnotType(type);
- splitToolManager?.SetCreateAnnotType(type);
- }
- public void SetCreateWidgetType(C_WIDGET_TYPE type)
- {
- toolManager?.SetCreateWidgetType(type);
- splitToolManager?.SetCreateWidgetType(type);
- }
- public void SetAnnotParam(AnnotParam param)
- {
- DefaultSettingParam defaultSettingParam = viewerTool.GetDefaultSettingParam();
- DefaultSettingParam splitSettingParam = splitViewerTool.GetDefaultSettingParam();
- defaultSettingParam.SetAnnotParam(param);
- splitSettingParam.SetAnnotParam(param);
- }
- public void SetIsShowStampMouse(bool isShow)
- {
- viewerTool?.GetCPDFViewer()?.SetIsShowStampMouse(isShow);
- splitViewerTool?.GetCPDFViewer()?.SetIsShowStampMouse(isShow);
- }
- public void SetDrawModes(DrawModeData drawMode)
- {
- viewerTool?.GetCPDFViewer()?.SetDrawModes(drawMode.DrawMode);
- splitViewerTool?.GetCPDFViewer()?.SetDrawModes(drawMode.DrawMode);
- if (drawMode.DrawMode == DrawMode.Custom)
- {
- viewerTool?.GetCPDFViewer().SetPDFBackground(drawMode.CustomColor);
- splitViewerTool?.GetCPDFViewer().SetPDFBackground(drawMode.CustomColor);
- }
- UpdateRenderFrame();
- }
- public void SetStampMouseImage(byte[] imageArray, int imageWidth, int imageHeight)
- {
- viewerTool?.GetCPDFViewer()?.SetStampMouseImage(imageArray, imageWidth, imageHeight);
- splitViewerTool?.GetCPDFViewer()?.SetStampMouseImage(imageArray, imageWidth, imageHeight);
- }
- public bool SetStampMouseImage(string filePath)
- {
- if ((bool)(viewerTool?.GetCPDFViewer()?.SetStampMouseImage(filePath)) && (bool)splitViewerTool?.GetCPDFViewer()?.SetStampMouseImage(filePath))
- {
- return true;
- }
- return false;
- }
- public void SetIsVisibleCustomMouse(bool isVisbleCustomMouse)
- {
- viewerTool?.GetCPDFViewer()?.SetIsVisibleCustomMouse(isVisbleCustomMouse);
- splitViewerTool?.GetCPDFViewer()?.SetIsVisibleCustomMouse(isVisbleCustomMouse);
- }
- public CPDFViewer GetCPDFViewer()
- {
- return FocusPDFViewTool?.GetCPDFViewer();
- }
- public BaseWidget GetCacheHitTestWidget()
- {
- return FocusPDFViewTool?.GetCacheHitTestWidget();
- }
- public BaseAnnot GetCacheHitTestAnnot()
- {
- return FocusPDFViewTool?.GetCacheHitTestAnnot();
- }
- public void CreateViewerMenu(object sender, ref ContextMenu contextMenu)
- {
- MenuItem fitWidthMenu = new MenuItem();
- fitWidthMenu.Header = LanguageHelper.CommonManager.GetString("Menu_AutoSize");
- fitWidthMenu.Click += (o, p) =>
- {
- FocusPDFViewTool?.GetCPDFViewer()?.SetFitMode(FitMode.FitWidth);
- FocusPDFViewTool?.GetCPDFViewer()?.UpdateRenderFrame();
- };
- contextMenu.Items.Add(fitWidthMenu);
-
- MenuItem fitSizeMenu = new MenuItem();
- fitSizeMenu.Header = LanguageHelper.CommonManager.GetString("Menu_RealSize");
- fitSizeMenu.Click += (o, p) =>
- {
- FocusPDFViewTool?.GetCPDFViewer()?.SetFitMode(FitMode.FitOriginal);
- FocusPDFViewTool?.GetCPDFViewer()?.UpdateRenderFrame();
- };
- contextMenu.Items.Add(fitSizeMenu);
-
- MenuItem zoomInMenu = new MenuItem();
- zoomInMenu.Header = LanguageHelper.CommonManager.GetString("Menu_ZoomIn");
- zoomInMenu.Click += (o, p) =>
- {
- FocusPDFViewTool?.GetCPDFViewer()?.SetFitMode(FitMode.FitZoom);
- double zoom = FocusPDFViewTool?.GetCPDFViewer()?.GetZoom() ?? 1;
- FocusPDFViewTool?.GetCPDFViewer()?.SetZoom(CheckZoomLevel(zoom, true));
- FocusPDFViewTool?.GetCPDFViewer()?.UpdateRenderFrame();
- };
- contextMenu.Items.Add(zoomInMenu);
-
- MenuItem zoomOutMenu = new MenuItem();
- zoomOutMenu.Header = LanguageHelper.CommonManager.GetString("Menu_ZoomOut");
- zoomOutMenu.Click += (o, p) =>
- {
- FocusPDFViewTool?.GetCPDFViewer()?.SetFitMode(FitMode.FitZoom);
- double zoom = FocusPDFViewTool?.GetCPDFViewer()?.GetZoom() ?? 1;
- FocusPDFViewTool?.GetCPDFViewer()?.SetZoom(CheckZoomLevel(zoom, false));
- FocusPDFViewTool?.GetCPDFViewer()?.UpdateRenderFrame();
- };
- contextMenu.Items.Add(zoomOutMenu);
-
- contextMenu.Items.Add(new Separator());
-
- MenuItem singleView = new MenuItem();
- singleView.Header = LanguageHelper.CommonManager.GetString("Menu_SinglePage");
- singleView.Click += (o, p) =>
- {
- FocusPDFViewTool?.GetCPDFViewer()?.SetViewMode(ViewMode.Single);
- FocusPDFViewTool?.GetCPDFViewer()?.UpdateRenderFrame();
- };
- contextMenu.Items.Add(singleView);
-
- MenuItem singleContinuousView = new MenuItem();
- singleContinuousView.Header = LanguageHelper.CommonManager.GetString("Menu_SingleContinuous");
- singleContinuousView.Click += (o, p) =>
- {
- FocusPDFViewTool?.GetCPDFViewer()?.SetViewMode(ViewMode.SingleContinuous);
- FocusPDFViewTool?.GetCPDFViewer()?.UpdateRenderFrame();
- };
- contextMenu.Items.Add(singleContinuousView);
-
- MenuItem doubleView = new MenuItem();
- doubleView.Header = LanguageHelper.CommonManager.GetString("Menu_DoublePage");
- doubleView.Click += (o, p) =>
- {
- FocusPDFViewTool?.GetCPDFViewer()?.SetViewMode(ViewMode.Double);
- FocusPDFViewTool?.GetCPDFViewer()?.UpdateRenderFrame();
- };
- contextMenu.Items.Add(doubleView);
-
- MenuItem doubleContinuousView = new MenuItem();
- doubleContinuousView.Header = LanguageHelper.CommonManager.GetString("Menu_DoubleContinuous");
- doubleContinuousView.Click += (o, p) =>
- {
- FocusPDFViewTool?.GetCPDFViewer()?.SetViewMode(ViewMode.DoubleContinuous);
- FocusPDFViewTool?.GetCPDFViewer()?.UpdateRenderFrame();
- };
- contextMenu.Items.Add(doubleContinuousView);
- contextMenu.Items.Add(new Separator());
-
- MenuItem resetFormMenu = new MenuItem();
- resetFormMenu.Header = LanguageHelper.CommonManager.GetString("Menu_Reset");
- resetFormMenu.Click += (o, p) =>
- {
- //FocusPDFViewTool?.GetCPDFViewer()?.ResetForm();
- };
- contextMenu.Items.Add(resetFormMenu);
- }
- private void RemoveSplitViewerTool()
- {
- UpdateRenderFrame();
- VerticalSplitter.Visibility = Visibility.Collapsed;
- HorizontalSplitter.Visibility = Visibility.Collapsed;
- VerticalView.Visibility = Visibility.Collapsed;
- HorizontalView.Visibility = Visibility.Collapsed;
- ViewToolGrid.ColumnDefinitions[1].Width = new GridLength(0);
- ViewToolGrid.ColumnDefinitions[2].Width = new GridLength(0);
- ViewToolGrid.RowDefinitions[1].Height = new GridLength(0);
- ViewToolGrid.RowDefinitions[2].Height = new GridLength(0);
- VerticalView.Child = null;
- HorizontalView.Child = null;
- }
- public void WindowSizeChange()
- {
- if(VerticalView.Visibility == Visibility.Visible)
- {
- ViewToolGrid.ColumnDefinitions[2].Width = new GridLength(ViewToolGrid.ActualWidth * splitWidthScale);
- }
- if(HorizontalView.Visibility == Visibility.Visible)
- {
- ViewToolGrid.RowDefinitions[2].Height = new GridLength(ViewToolGrid.ActualHeight * splitHeightScale);
- }
- }
- private void PDFView_GotFocus(object sender, RoutedEventArgs e)
- {
- switch ((sender as Border).Tag)
- {
- case "ViewerTool":
- FocusPDFViewTool = viewerTool;
- break;
- case "SplitViewerTool":
- FocusPDFViewTool = splitViewerTool;
- break;
- }
- if (FocusPDFViewTool.IsLoaded)
- {
- FocusPDFViewToolChanged?.Invoke(this, EventArgs.Empty);
- }
- }
- #region Private Command Methods
- private double CheckZoomLevel(double zoom, bool IsGrowth)
- {
- zoom += (IsGrowth ? 0.01 : -0.01);
- double standardZoom = 100;
- if (zoom <= 0.01)
- {
- return 0.01;
- }
- if (zoom >= 10)
- {
- return 10;
- }
- zoom *= 100;
- for (int i = 0; i < zoomLevelList.Length - 1; i++)
- {
- if (zoom > zoomLevelList[i] && zoom <= zoomLevelList[i + 1] && IsGrowth)
- {
- standardZoom = zoomLevelList[i + 1];
- break;
- }
- if (zoom >= zoomLevelList[i] && zoom < zoomLevelList[i + 1] && !IsGrowth)
- {
- standardZoom = zoomLevelList[i];
- break;
- }
- }
- return standardZoom / 100;
- }
- #endregion
- private void PDFView_MouseDown(object sender, MouseButtonEventArgs e)
- {
- switch ((sender as Border).Tag)
- {
- case "ViewerTool":
- FocusPDFViewTool = viewerTool;
- break;
- case "SplitViewerTool":
- FocusPDFViewTool = splitViewerTool;
- break;
- }
- if (FocusPDFViewTool.IsLoaded&& FocusPDFViewTool.GetCPDFViewer()?.CurrentRenderFrame != null)
- {
- FocusPDFViewToolChanged?.Invoke(this, EventArgs.Empty);
- }
- }
- }
- }
|