Browse Source

Merge remote-tracking branch 'origin/ComPDFKit_Rebuild' into compdfkit_demo_win_rebuild

# Conflicts:
#	Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml.cs
zhuyi 1 năm trước cách đây
mục cha
commit
d2da8266a8

+ 5 - 1
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListControl/CPDFAnnotationListControl.xaml.cs

@@ -67,7 +67,11 @@ namespace Compdfkit_Tools.PDFControl
             else
             {
                 BaseAnnot baseAnnot= pdfViewer.PDFToolManager.GetCacheHitTestAnnot();
-                AnnotationList.SelectAnnotationChanged(baseAnnot.GetAnnotData().PageIndex,baseAnnot.GetAnnotData().AnnotIndex);
+                AnnotData annotData = baseAnnot?.GetAnnotData();
+                if(annotData != null)
+                {
+                    AnnotationList.SelectAnnotationChanged(annotData.PageIndex, annotData.AnnotIndex);
+                }
             }
         }
 

+ 12 - 4
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationPanel/PDFAnnotationControl/CPDFAnnotationControl.xaml.cs

@@ -281,8 +281,12 @@ namespace Compdfkit_Tools.PDFControl
                         annotHandlerEventArgs.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE;
                         byte[] LineColor = new byte[] { squareData.BorderColor.R, squareData.BorderColor.G, squareData.BorderColor.B };
                         (annotHandlerEventArgs as SquareParam).LineColor = LineColor;
-                        byte[] FillColor = new byte[] { squareData.FillColor.R, squareData.FillColor.G, squareData.FillColor.B };
-                        (annotHandlerEventArgs as SquareParam).BgColor = FillColor;
+                        if(squareData.FillColor!=Colors.Transparent)
+                        {
+                            byte[] FillColor = new byte[] { squareData.FillColor.R, squareData.FillColor.G, squareData.FillColor.B };
+                            (annotHandlerEventArgs as SquareParam).BgColor = FillColor;
+                            (annotHandlerEventArgs as SquareParam).HasBgColor = true;
+                        }
                         (annotHandlerEventArgs as SquareParam).LineWidth = squareData.Thickness;
                         (annotHandlerEventArgs as SquareParam).Transparency = Convert.ToByte(squareData.Opacity * 255);
                         ParamConverter.ParseDashStyle(squareData.DashStyle, out float[] LineDash, out C_BORDER_STYLE BorderStyle);
@@ -302,8 +306,12 @@ namespace Compdfkit_Tools.PDFControl
                         annotHandlerEventArgs.CurrentType = C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE;
                         byte[] LineColor = new byte[] { cicleData.BorderColor.R, cicleData.BorderColor.G, cicleData.BorderColor.B };
                         (annotHandlerEventArgs as CircleParam).LineColor = LineColor;
-                        byte[] BgColor = new byte[] { cicleData.FillColor.R, cicleData.FillColor.G, cicleData.FillColor.B };
-                        (annotHandlerEventArgs as CircleParam).BgColor = BgColor;
+                        if(cicleData.FillColor!=Colors.Transparent)
+                        {
+                            byte[] BgColor = new byte[] { cicleData.FillColor.R, cicleData.FillColor.G, cicleData.FillColor.B };
+                            (annotHandlerEventArgs as CircleParam).BgColor = BgColor;
+                            (annotHandlerEventArgs as CircleParam).HasBgColor=true;
+                        }
                         (annotHandlerEventArgs as CircleParam).LineWidth = cicleData.Thickness;
                         (annotHandlerEventArgs as CircleParam).Transparency = Convert.ToByte(cicleData.Opacity * 255);
                         ParamConverter.ParseDashStyle(cicleData.DashStyle, out float[] LineDash, out C_BORDER_STYLE BorderStyle);

+ 1 - 1
Demo/Examples/Compdfkit_Tools/PDFView/PDFDisplaySettings/PDFDisplaySettingsControl/CPDFDisplaySettingsControl.xaml.cs

@@ -67,7 +67,7 @@ namespace Compdfkit_Tools.PDFControl
                 if (pdfViewer != null)
                 {
                     pdfViewer?.SetViewMode(e);
-                    pdfViewer.UpDataRenderFrame();
+                    pdfViewer?.UpDataRenderFrame();
                 }
             }   
         }

+ 13 - 4
Demo/Examples/Compdfkit_Tools/PDFView/PDFScaling/PDFScalingControl/CPDFScalingControl.xaml.cs

@@ -49,15 +49,19 @@ namespace Compdfkit_Tools.PDFControl
          
             if (pdfViewer.GetZoom() < 3)
             {
-                pdfViewer.SetZoom(pdfViewer.GetZoom() - 0.1);
+                double newZoom = Math.Max(0.01, pdfViewer.GetZoom() - 0.1);
+                pdfViewer.SetZoom(newZoom);
+                pdfViewer.UpDataRenderFrame();
             }
             else if (pdfViewer.GetZoom() < 6)
             {
                 pdfViewer.SetZoom(pdfViewer.GetZoom() - 0.2);
+                pdfViewer.UpDataRenderFrame();
             }
-            else if (pdfViewer.GetZoom() <= 10)
+            else if (pdfViewer.GetZoom() >6)
             {
                 pdfViewer.SetZoom(pdfViewer.GetZoom() - 0.3);
+                pdfViewer.UpDataRenderFrame();
             }
             SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewer.GetZoom() * 100)));
         }
@@ -77,16 +81,20 @@ namespace Compdfkit_Tools.PDFControl
             if (pdfViewer.GetZoom() < 3)
             {
                 pdfViewer.SetZoom(pdfViewer.GetZoom() + 0.1);
+                pdfViewer.UpDataRenderFrame();
             }
             else if (pdfViewer.GetZoom() < 6)
             {
                 pdfViewer.SetZoom(pdfViewer.GetZoom() + 0.2);
+                pdfViewer.UpDataRenderFrame();
             }
             else if (pdfViewer.GetZoom() <= 10)
             {
-                pdfViewer.SetZoom(pdfViewer.GetZoom() + 0.3);
+                double newZoom = Math.Max(10, pdfViewer.GetZoom() + 0.3);
+                pdfViewer.SetZoom(newZoom);
+                pdfViewer.UpDataRenderFrame();
             }
-            SetZoomTextBoxText(string.Format("{0}", (int)pdfViewer.GetZoom()* 100));
+            SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewer.GetZoom()* 100)));
         }
 
         private void PDFScalingControl_SetScaleEvent(object sender, string e)
@@ -104,6 +112,7 @@ namespace Compdfkit_Tools.PDFControl
             if (!string.IsNullOrEmpty(e))
             {
                 pdfViewer.SetZoom(double.Parse(e) / 100);
+                pdfViewer.UpDataRenderFrame();
                 SetZoomTextBoxText(string.Format("{0}", (int)(pdfViewer.GetZoom() * 100)));
             }
         }