1
1
Эх сурвалжийг харах

Implement button for color picker

Ruben 5 жил өмнө
parent
commit
52c1309bbf

+ 6 - 4
PicView/Shortcuts/MainShortcuts.cs

@@ -581,9 +581,6 @@ namespace PicView.Shortcuts
                 Editing.Color_Picking.StartRunning();
             }
 
-            
-
-
             #endregion Alt + keys
         }
 
@@ -619,8 +616,13 @@ namespace PicView.Shortcuts
                     if (IsAutoScrolling)
                     {
                         StopAutoScroll();
+                        return;
+                    }
+                    else
+                    {
+                        Editing.Color_Picking.StopRunning(true);
+                        return;
                     }
-                    break;
 
                 case MouseButton.Middle:
                     if (!IsAutoScrolling)

+ 9 - 0
PicView/UI/DragAndDrop/DragToExplorer.cs

@@ -1,5 +1,6 @@
 using PicView.Library;
 using PicView.UI.TransformImage;
+using PicView.UI.UserControls;
 using System;
 using System.Collections.Specialized;
 using System.IO;
@@ -30,6 +31,14 @@ namespace PicView.UI.DragAndDrop
                 return;
             }
 
+            if (UC.GetColorPicker != null)
+            {
+                if (UC.GetColorPicker.Opacity == 1)
+                {
+                    return;
+                }
+            }
+
             var pos = Utilities.GetMousePos(TheMainWindow.ParentContainer);
 
             //Tooltip.ShowTooltipMessage($"x = {pos.X} y = {pos.Y}");

+ 8 - 5
PicView/UI/TransformImage/Zoom.cs

@@ -104,11 +104,6 @@ namespace PicView.UI.TransformImage
                 return;
             }
 
-            if ((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt)
-            {
-                Editing.Color_Picking.StopRunning(true);
-            }
-
             // Fix focus
             EditTitleBar.Refocus();
 
@@ -185,6 +180,14 @@ namespace PicView.UI.TransformImage
                 AutoScrollTimer.Start();
             }
 
+            if (Keyboard.Modifiers != ModifierKeys.Alt && UC.GetColorPicker != null)
+            {
+                if (UC.GetColorPicker.Opacity == 1)
+                {
+                    Editing.Color_Picking.StartRunning();
+                }
+            }
+
             // Don't drag when full scale
             // and don't drag it if mouse not held down on image
             if (!TheMainWindow.MainImage.IsMouseCaptured || scaleTransform.ScaleX == 1)

+ 1 - 1
PicView/UI/UserControls/Menus/ToolsAndEffectsMenu.xaml

@@ -176,7 +176,7 @@
                     <Button
                         x:Name="ColorPickerButton"
                         FontWeight="Bold"
-                        ToolTip="Pick color from image (not implemented yet)">
+                        ToolTip="Pick color from image [Alt]">
                         <Canvas>
                             <TextBlock
                                 Canvas.Left="-69"

+ 11 - 0
PicView/UI/UserControls/Menus/ToolsAndEffectsMenu.xaml.cs

@@ -45,6 +45,17 @@ namespace PicView.UI.UserControls
                 UC.Close_UserControls();
                 CropFunctions.StartCrop();
             };
+
+            // ColorPickerButton
+            ColorPickerButton.PreviewMouseLeftButtonDown += (s, x) => PreviewMouseButtonDownAnim(ColorPickerButtonBrush);
+            ColorPickerButton.MouseEnter += (s, x) => ButtonMouseOverAnim(ColorPickerButtonBrush, true);
+            ColorPickerButton.MouseLeave += (s, x) => ButtonMouseLeaveAnimBgColor(ColorPickerButtonBrush, false);
+            ColorPickerButton.Click += delegate
+            {
+                UC.Close_UserControls();
+                Color_Picking.StartRunning();
+            };
+
         }
     }
 }