Переглянути джерело

【编辑PDF】修改图片不透明度,点击页面空白处,重新点击图片,属性面板不透明度值为空白

OYXH\oyxh 1 рік тому
батько
коміт
265b301bf4

+ 21 - 1
PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageEditPropertyViewModel.cs

@@ -66,6 +66,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         #region 是否为多选内容
 
         private bool _isMultiSelectImage = false;
+
         public bool IsMultiSelectImage
         { get { return _isMultiSelectImage; } set { SetProperty(ref _isMultiSelectImage, value); } }
 
@@ -106,7 +107,25 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 SetProperty(ref _transpent, value);
                 if (Transpent == 100 || Transpent == 75 || Transpent == 50 || (Transpent == 25))
                 {
-                    TextEditEvent.Transparency = (int)((_transpent * 255) / 100.0);
+                    switch (Transpent)
+                    {
+                        case 25:
+                            OpacitySelectedIndex = 0;
+                            break;
+
+                        case 50:
+                            OpacitySelectedIndex = 1;
+                            break;
+
+                        case 75:
+                            OpacitySelectedIndex = 2;
+                            break;
+
+                        case 100:
+                            OpacitySelectedIndex = 3;
+                            break;
+                    }
+                    TextEditEvent.Transparency = (int)Math.Ceiling((double)(_transpent * 255) / 100.0);
                     TextEditEvent.UpdatePDFEditByEventArgs();
                     OpacityUI = _transpent / 100.0;
                 }
@@ -122,6 +141,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 
         public bool IsCrop
         { get { return _isCrop; } set { SetProperty(ref _isCrop, value); } }
+
         public TextEditToolContentViewModel _viewModel1;
 
         //public ImageEditPropertyViewModel(TextEditToolContentViewModel viewModel1)