소스 검색

ComPDFKit.Demo(win) - 修复点击非测量注释,测量属性面板未清空的问题

TangJinZhou 1 주 전
부모
커밋
ae412881ba
1개의 변경된 파일17개의 추가작업 그리고 10개의 파일을 삭제
  1. 17 10
      Demo/Examples/Compdfkit.Controls/Measure/MeasurePropertyControl.xaml.cs

+ 17 - 10
Demo/Examples/Compdfkit.Controls/Measure/MeasurePropertyControl.xaml.cs

@@ -84,33 +84,39 @@ namespace ComPDFKit.Controls.Measure
             switch (param.CurrentType)
             {
                 case C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
-
-                    if (param is LineMeasureParam lineMeasureParam)
                     {
-                        straightnessProperty.SetAnnotParam(lineMeasureParam, annot, viewControl);
+                        if (param is LineMeasureParam lineMeasureParam)
+                        {
+                            straightnessProperty.SetAnnotParam(lineMeasureParam, annot, viewControl);
+                            SetMeasurePanel(straightnessProperty);
+                            return;
+                        }
                     }
-
-                    currentPanel = straightnessProperty;
-
                     break;
+
                 case C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE:
                     if (param is PolyLineMeasureParam polyLineMeasureParam)
                     {
                         multilineProperty.SetAnnotParam(polyLineMeasureParam, annot, viewControl);
+                        SetMeasurePanel(multilineProperty);
+                        return;
                     }
-                    currentPanel = multilineProperty;
                     break;
+
                 case C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON:
-                    if (param is PolygonMeasureParam polygonMeasureParam)
+                    if (param is PolygonMeasureParam polygonMeasureParam && (annot ==null || (annot as CPDFPolygonAnnotation).IsMeasured()))
                     {
                         polygonProperty.SetAnnotParam(polygonMeasureParam, annot, viewControl);
+                        SetMeasurePanel(polygonProperty);
+                        return;
                     }
-                    currentPanel = polygonProperty;
                     break;
+
                 default:
                     break;
             }
-            SetMeasurePanel(currentPanel);
+
+            ClearMeasurePanel();
         }
 
         private void StraightnessProperty_LineMeasureParamChanged(object sender, LineMeasureParam e)
@@ -120,6 +126,7 @@ namespace ComPDFKit.Controls.Measure
 
         private void SetMeasurePanel(UIElement newChild)
         {
+            currentPanel = newChild;
             MeasurePropertyPanel.Child = newChild;
         }