123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using ComPDFKit.Tool.DrawTool;
- using ComPDFKitViewer.Helper;
- using ComPDFKitViewer.Layer;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- namespace ComPDFKit.Tool
- {
- public partial class CPDFViewerTool
- {
- int selectImageTag = -1;
- private bool enableImageSelect = true;
- private void InsertSelectImageView()
- {
- SelectImage createAnnotTool = new SelectImage();
- int SelectTextindex = PDFViewer.GetMaxViewIndex();
- PDFViewer.InsertView(SelectTextindex, createAnnotTool);
- selectImageTag = createAnnotTool.GetResTag();
- }
- public void SetImageSelectEnable(bool enable)
- {
- enableImageSelect=enable;
- if (enableImageSelect==false && PDFViewer!=null)
- {
- SelectImage imageLayer = PDFViewer.GetViewForTag(selectImageTag) as SelectImage;
- if (imageLayer != null)
- {
- imageLayer.CleanDraw(PDFViewer);
- }
- }
- }
- public bool DrawMoveSelectImage()
- {
- bool isSelect = false;
- if (PDFViewer.CurrentRenderFrame == null || enableImageSelect == false)
- {
- return isSelect;
- }
- BaseLayer baseLayer = PDFViewer.GetViewForTag(selectImageTag);
- PDFViewer.GetMousePointToPage(out int pageindex, out Point pagepoint);
- isSelect=(baseLayer as SelectImage).ProcessMouseMoveForSelectImage(
- new Point(DpiHelper.StandardNumToPDFNum(pagepoint.X / PDFViewer.CurrentRenderFrame.ZoomFactor),
- DpiHelper.StandardNumToPDFNum(pagepoint.Y / PDFViewer.CurrentRenderFrame.ZoomFactor)),
- pageindex, PDFViewer);
- (baseLayer as SelectImage).Draw(PDFViewer);
- return isSelect;
- }
- public bool DrawDownSelectImage(bool isNeedClear)
- {
- bool isSelect = false;
- if (PDFViewer.CurrentRenderFrame == null || enableImageSelect == false)
- {
- return isSelect;
- }
- BaseLayer baseLayer = PDFViewer.GetViewForTag(selectImageTag);
- PDFViewer.GetMousePointToPage(out int pageindex, out Point pagepoint);
- isSelect=(baseLayer as SelectImage).ProcessMouseDownForSelectImage(
- new Point(DpiHelper.StandardNumToPDFNum(pagepoint.X / PDFViewer.CurrentRenderFrame.ZoomFactor),
- DpiHelper.StandardNumToPDFNum(pagepoint.Y / PDFViewer.CurrentRenderFrame.ZoomFactor)),
- pageindex, PDFViewer, isNeedClear);
- (baseLayer as SelectImage).Draw(PDFViewer);
- return isSelect;
- }
- public void ReDrawSelectImage()
- {
- if(enableImageSelect == false)
- {
- return;
- }
- BaseLayer baseLayer = PDFViewer.GetViewForTag(selectImageTag);
- (baseLayer as SelectImage).Draw(PDFViewer);
- }
- public void CleanDrawSelectImage()
- {
- if (enableImageSelect == false)
- {
- return;
- }
- BaseLayer baseLayer = PDFViewer.GetViewForTag(selectImageTag);
- (baseLayer as SelectImage).CleanDraw(PDFViewer);
- }
- //public PageImageItem GetSelectImage()
- //{
- // BaseLayer baseLayer = PDFViewer.GetViewForTag(selectImageTag);
- // return (baseLayer as SelectImage).GetHoverImageItem();
- //}
- public Dictionary<int, List<PageImageItem>> GetSelectImageItems()
- {
- if (enableImageSelect == false)
- {
- return new Dictionary<int, List<PageImageItem>>();
- }
- BaseLayer baseLayer = PDFViewer.GetViewForTag(selectImageTag);
- return (baseLayer as SelectImage).GetSelectImageItems();
- }
- }
- }
|