Parcourir la source

compdfkit(win) - 选中项为空时,当前模式为创建text,不清除属性面板

liuaoran il y a 8 mois
Parent
commit
58b0d7bfad

+ 7 - 53
Demo/Examples/Compdfkit_Tools/Edit/ContentEditCOntrol/ContentEditControl.xaml.cs

@@ -713,7 +713,7 @@ namespace Compdfkit_Tools.PDFControl
         private void PDFToolManager_MouseLeftButtonDownHandler(object sender, MouseEventObject e)
         {
             isUpdateStartPoint = true;
-            if (PdfViewControl.PDFToolManager.GetToolType() == ToolType.ContentEdit)
+            if (PdfViewControl.PDFToolManager.GetToolType() != ToolType.ContentEdit)
             {
                 PropertyContainer.Child = pdfContentEditControl;
                 return;
@@ -721,9 +721,12 @@ namespace Compdfkit_Tools.PDFControl
 
             int PageIndex = -1;
             CPDFEditArea editAreaArea = PdfViewControl.PDFToolManager.GetSelectedEditAreaObject(ref PageIndex);
-            if (editAreaArea.Type != CPDFEditType.EditText && editAreaArea == null)
+            if (editAreaArea == null)
             {
-                pdfContentEditControl.ClearContentControl();
+                if (PdfViewControl.PDFToolManager.GetCreateContentEditType() != CPDFEditType.EditText)
+                {
+                    pdfContentEditControl.ClearContentControl(); 
+                }
                 return;
             }
             else
@@ -746,8 +749,7 @@ namespace Compdfkit_Tools.PDFControl
                     PDFEditParam pDFEditParam = ParamConverter.CPDFDataConverterToPDFEitParam(PdfViewControl.PDFToolManager.GetDocument(), editAreaArea, PageIndex);
                     pdfContentEditControl.SetPDFImageEditData((ImageEditParam)pDFEditParam);
                     PropertyContainer.Child = pdfContentEditControl;
-                }
-                //panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
+                } 
             }
         }
 
@@ -757,54 +759,6 @@ namespace Compdfkit_Tools.PDFControl
             PdfViewControl.PDFViewTool.GetCPDFViewer().UndoManager.PropertyChanged += UndoManager_PropertyChanged;
         }
 
-        /// <summary>
-        /// Text and Image Selected Event
-        /// </summary>
-        private void PDFView_PDFEditActiveHandler(object sender, PDFEditParam e)
-        {
-            imageAreaParam = e;
-
-            if (e == null)
-            {
-                PropertyContainer.Child = pdfContentEditControl;
-
-                //if (pdfTextCreateParam != null && PdfViewControl != null && PdfViewControl.PDFView != null)
-                //{
-                //    if (PdfViewControl.PDFView.GetPDFEditCreateType() == CPDFEditType.EditText)
-                //    {
-                //        pdfContentEditControl.SetPDFTextEditData(pdfTextCreateParam);
-                //    }
-                //    else if (PdfViewControl.PDFView.GetPDFEditCreateType() == CPDFEditType.None)
-                //    {
-                //        pdfContentEditControl.ClearContentControl();
-                //    }
-                //}
-                //else
-                //{
-                //    pdfContentEditControl.ClearContentControl();
-                //}
-                return;
-            }
-
-            if (e.EditType == CPDFEditType.EditText)
-            {
-                pdfContentEditControl.SetPDFTextEditData((TextEditParam)e, true);
-                return;
-            }
-
-            if (e.EditType == CPDFEditType.EditImage && PdfViewControl != null)
-            {
-                UIElement pageView = sender as UIElement;
-                if (pageView != null)
-                {
-                    pageView.MouseLeftButtonUp -= PageView_MouseLeftButtonUp;
-                    pageView.MouseLeftButtonUp += PageView_MouseLeftButtonUp;
-                }
-                pdfContentEditControl.SetPDFImageEditData((ImageEditParam)e);
-                return;
-            }
-        }
-
         private void PageView_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
         {
             UIElement pageView = sender as UIElement;