ソースを参照

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

TangJinZhou 1 週間 前
コミット
ae412881ba

+ 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;
         }