Bladeren bron

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

TangJinZhou 2 weken geleden
bovenliggende
commit
ae412881ba
1 gewijzigde bestanden met toevoegingen van 17 en 10 verwijderingen
  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;
         }