Browse Source

页面编辑自测bug修复

lvle 1 năm trước cách đây
mục cha
commit
335f2ba7c5

+ 2 - 2
PDF Office/CustomControl/CompositeControl/SlidComboControl.xaml

@@ -569,8 +569,8 @@
             FontFamily="Segoe UI"
             FontSize="14"
             Foreground="{StaticResource color.sys.text.neutral.lv2}"
-            LineHeight="20">
-            Line Width
+            LineHeight="20"
+            Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:SlidComboControl}, Path=Title}">
         </TextBlock>
 
         <Grid Grid.Row="1">

+ 30 - 4
PDF Office/CustomControl/CompositeControl/SlidComboControl.xaml.cs

@@ -25,8 +25,29 @@ namespace PDF_Master.CustomControl.CompositeControl
     public partial class SlidComboControl : UserControl
     {
         public List<ComboDataItem> Items { get;private set; }    
-        public event RoutedEventHandler ValueChanged;
-        
+        public event RoutedEventHandler ValueChanged;
+        public string Title
+        {
+            get { return (string)GetValue(TitleProperty); }
+            set {
+                SetValue(TitleProperty, value); }
+        }
+
+      
+        public static readonly DependencyProperty TitleProperty =
+            DependencyProperty.Register("Title", typeof(string), typeof(SlidComboControl), new PropertyMetadata("Line Width"));
+
+
+        public string Unit
+        { 
+            get { return (string)GetValue(UnitProperty); }
+            set { SetValue(UnitProperty, value); }
+        }
+
+
+        public static readonly DependencyProperty UnitProperty =
+            DependencyProperty.Register("Unit", typeof(string), typeof(SlidComboControl), new PropertyMetadata("pt"));
+
         public SlidComboControl()
         {
             InitializeComponent();
@@ -39,7 +60,12 @@ namespace PDF_Master.CustomControl.CompositeControl
 
         private void SetLanguage()
         {
-            thicknessText.Text = App.MainPageLoader.GetString("Annotation_Thickness");
+            //焊死了
+            if(thicknessText.Text== "Line Width")
+            {
+                thicknessText.Text = App.MainPageLoader.GetString("Annotation_Thickness");
+            }
+            
         }
 
         public void SetItemSource(List<ComboDataItem> items)
@@ -140,7 +166,7 @@ namespace PDF_Master.CustomControl.CompositeControl
             if (control != null)
             {
                 Trace.WriteLine("SelectedValuePropertyChanged" + value);
-                control.combox.SelectedItems = new ComboDataItem(value,"pt");
+                control.combox.SelectedItems = new ComboDataItem(value, control.Unit);
                 
             }
         }

+ 0 - 1
PDF Office/ViewModels/Dialog/ServiceDialog/LoginPasswordRegionViewModel.cs

@@ -46,7 +46,6 @@ namespace PDF_Master.ViewModels.Dialog.ServiceDialog
 
 
         #region 文案
-
         private string _Text_Login = "";
 
         public string Text_Login

+ 41 - 2
PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageEditPropertyViewModel.cs

@@ -19,19 +19,51 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
 {
     public class ImageEditPropertyViewModel : PDFEditVM, INavigationAware
     {
+        
         #region 变量
         //防止自动保存属性值
         private bool isCanSave = false;
         public event EventHandler ClearCheckedAglin;
         #endregion
+        #region 快捷键
+        private void ShortCut_KeyDown(object sender, KeyEventArgs e)
+        {
+
+
+            if (e.Key == Key.Escape)
+            {
+                if (PDFViewer != null)
+                {
+                    if (PDFViewer.ToolManager != null && IsCrop == true)
+                    {
+                        CancelCropImg();
+
+                    } 
+                   
+                }
+            }
+            if(e.Key==Key.Enter)
+            {
+                CropImg();
+            }
+
+        }
 
+
+        #endregion
         #region 属性
 
         #region 是否为多选内容
         private bool _isMultiSelectImage = false;
         public bool IsMultiSelectImage { get { return _isMultiSelectImage; } set { SetProperty(ref _isMultiSelectImage, value); } }
         #endregion
-
+       
+       private string _opacity1= "Opacity";
+        public string Opacity
+        {
+            get { return _opacity1; }
+            set { SetProperty(ref _opacity1, value); }
+        }
         #region 不透明度
         private double _opacity;
         public double OpacityUI
@@ -172,6 +204,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 TextEditEvent.ClipImage = false;
                 TextEditEvent.UpdatePDFEditByEventArgs();
                 IsCrop = false;
+                GetImagePreView();
             }
         }
 
@@ -346,6 +379,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
                 PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
                 PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
                 PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
+                KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
+                KeyEventsHelper.KeyDown += ShortCut_KeyDown;
                 LoadedPDFEdit();
                 isCanSave = true;
             }
@@ -541,7 +576,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
          
         }
         #region 全局
-
+        //private void ShowPropertyPanel(bool show = true)
+        //{
+        //    viewContentViewModel.IsPropertyOpen = show;
+        //}
         #endregion
         public bool IsNavigationTarget(NavigationContext navigationContext) { return true; }
 
@@ -554,6 +592,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             ClearCheckedAglin?.Invoke(null, null);
             PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
             PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
+            KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
         }
     }
 }

+ 42 - 26
PDF Office/ViewModels/PropertyPanel/PDFEdit/TextEditPropertyViewModel.cs

@@ -25,6 +25,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
     
     public class TextEditPropertyViewModel : PDFEditVM, INavigationAware
     {
+        
         #region
         private bool isSelectedEmpty;
         public bool IsSelectedEmpty
@@ -32,6 +33,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             get { return isSelectedEmpty; }
             set { SetProperty(ref isSelectedEmpty, value); }
         }
+
+        private String _CurrentColor;
+        public String CurrentColor
+        {
+            get { return _CurrentColor; }
+            set { SetProperty(ref _CurrentColor, value); }
+        }
         private ComPDFKit.PDFPage.Edit.TextAlignType _textAlign;
         public ComPDFKit.PDFPage.Edit.TextAlignType TextAlign
         {
@@ -434,31 +442,32 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
             {
                 case CommandType.Context:
 
-                  
-                     if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
-                    {
-                        //文字编辑
-                        if (e.PressOnBorder == true)
-                        {
-                            e.PopupMenu = SelectTextBorder(sender);
-                        }
-
-                         else if(e.PressOnSelectedText == true)
-                        {
-                            e.PopupMenu = SelectTextContent(sender);
-                        }
 
-                        else if(e.SelectText=="")
-                        {
-                            e.PopupMenu= EditTextContent(sender);
-                        }
-                        else
-                        {
-                            e.PopupMenu = SelectTextContent(sender);
-                        }
-
-                    }
-                   else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)
+                    //  if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
+                    // {
+                    //     //文字编辑
+                    //     if (e.PressOnBorder == true)
+                    //     {
+                    //         e.PopupMenu = SelectTextBorder(sender);
+                    //     }
+
+                    //      else if(e.PressOnSelectedText == true)
+                    //     {
+                    //         e.PopupMenu = SelectTextContent(sender);
+                    //     }
+
+                    //     else if(e.SelectText=="")
+                    //     {
+                    //         e.PopupMenu= EditTextContent(sender);
+                    //     }
+                    //     else
+                    //     {
+                    //         e.PopupMenu = SelectTextContent(sender);
+                    //     }
+
+                    // }
+                    //else
+                    if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)
                     {
                         e.PopupMenu = SelectMoreText(sender);
 
@@ -624,8 +633,15 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
         private void  GetPDFEdit()
         {
             if (TextEditEvent != null && TextEditEventList.Count == 1)
-            {
-                SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
+            {  if(TextEditEvent.FontSize==0)
+                {
+                    SelectColor = new SolidColorBrush(Colors.Black);
+                }
+            else
+                {
+                    SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
+
+                }
 
                 GetCurrentFontSize((int)TextEditEvent.FontSize);
 

+ 6 - 2
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -2092,9 +2092,13 @@ namespace PDF_Master.ViewModels.Tools
                             }
                         }
                     }
-                    else
+                    else 
                     {
-                        ExitAnnotationTool();
+                        if(PDFViewer.MouseMode!= MouseModes.PDFEdit)
+                        {
+                            ExitAnnotationTool();
+                        }
+                     
                     }
                 }
             }

+ 34 - 9
PDF Office/ViewModels/Tools/TextEditToolContentViewModel.cs

@@ -169,15 +169,16 @@ namespace PDF_Master.ViewModels.Tools
             {
                 if (PDFViewer != null)
                 {
-                   
 
-                    if (PDFViewer.ToolManager != null && IsTextEdit == true)
-                       {
 
-                           PDFViewer.RemovePDFEditEmptyText();
-                          PDFViewer.SetMouseMode(MouseModes.PDFEdit);
-                          PDFViewer.ReloadDocument();
-                          ShowPropertyPanel(true);
+                    if (PDFViewer.ToolManager != null && IsTextEdit == true)
+                    {
+           
+                        PDFViewer.SetPDFEditType(ComPDFKit.PDFPage.CPDFEditType.None);
+                        //PDFViewer.RemovePDFEditEmptyText();
+                        //PDFViewer.SetMouseMode(MouseModes.PDFEdit);
+                        //PDFViewer.ReloadDocument();
+                        //ShowPropertyPanel(false);
 
 
 
@@ -185,17 +186,19 @@ namespace PDF_Master.ViewModels.Tools
 
                     else if (PDFViewer.ToolManager != null && IsImgEdit == true)
                     {
+                      
                         PDFViewer.RemovePDFEditEmptyText();
                         PDFViewer.SetMouseMode(MouseModes.PDFEdit);
                         PDFViewer.ReloadDocument();
                         ShowPropertyPanel(true);
                     }
-                    if (PDFViewer.MouseMode == MouseModes.PDFEdit)
+
+                    if (PDFViewer.MouseMode == MouseModes.PDFEdit )
                     {
                         PDFViewer.RemoveTool(false);
                     }
                 }
-                }
+            }
           
 
         }
@@ -364,7 +367,29 @@ namespace PDF_Master.ViewModels.Tools
                     else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
                     {
 
+                           if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
+                    {
+                        //文字编辑
+                        if (e.PressOnBorder == true)
+                        {
                             e.PopupMenu = SelectTextBorder(sender);
+                        }
+
+                         else if(e.PressOnSelectedText == true)
+                        {
+                            e.PopupMenu = SelectTextContent(sender);
+                        }
+
+                        else if(e.SelectText=="")
+                        {
+                            e.PopupMenu= EditTextContent(sender);
+                        }
+                        else
+                        {
+                            e.PopupMenu = SelectTextContent(sender);
+                        }
+
+                    }
 
 
                     }

+ 2 - 0
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -729,6 +729,8 @@ namespace PDF_Master.ViewModels
         private bool botaState = false;
         private bool propertyOpenState = false;
 
+        public bool IsCrop=false;
+
         #endregion 属性、变量
 
         #region 命令

+ 2 - 0
PDF Office/Views/PropertyPanel/PDFEdit/ImageEditProperty.xaml

@@ -105,6 +105,8 @@
             <CompositeControl:SlidComboControl
                 x:Name="slid"
                 IsEnabled="{Binding IsCrop, Converter={StaticResource InvertBoolConvert}}"
+                Title="{Binding Opacity,Mode=TwoWay}"
+                Unit="%"
                 Value="{Binding Transpent, Mode=TwoWay}" />
             <StackPanel
                 Width="228"

+ 1 - 7
PDF Office/Views/PropertyPanel/PDFEdit/ImageEditProperty.xaml.cs

@@ -30,18 +30,12 @@ namespace PDF_Master.Views.PropertyPanel.PDFEdit
         private void Init()
         {
             Items = new List<ComboDataItem>();
-            var item = new ComboDataItem(0);
-            Items.Add(item);
-            item = new ComboDataItem(10);
-            Items.Add(item);
-            item = new ComboDataItem(25);
+            var item = new ComboDataItem(25);
             Items.Add(item);
             item = new ComboDataItem(50);
             Items.Add(item);
             item = new ComboDataItem(75);
             Items.Add(item);
-            item = new ComboDataItem(80);
-            Items.Add(item);
             item = new ComboDataItem(100);
             Items.Add(item);
             slid.SetItemSource(Items);