浏览代码

Light theme updates for new buttons in the bottom bar.

Add `x:Name` for buttons and refine hover styles in `BottomBar` and `ZoomPreviewer`

- Introduced `x:Name` for better targeting of buttons (`ZoomOutButton`, `ZoomInButton`, `FlipButton`, etc.).
- Updated button hover styles for consistency with theme settings.
- Improved conditional hover class adjustments in C# for dark theme support.
Ruben 1 周之前
父节点
当前提交
be7c3acb4b

+ 10 - 3
src/PicView.Avalonia/Views/UC/BottomBar.axaml

@@ -273,8 +273,11 @@
                     Icon="{StaticResource ZoomOutImage}"
                     IconHeight="16"
                     IconWidth="18"
+                    IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,
+                                                Converter={x:Static ObjectConverters.IsNotNull}}"
                     IsTabStop="False"
-                    Width="35" />
+                    Width="35"
+                    x:Name="ZoomOutButton" />
 
                 <customControls:IconButton
                     Background="{DynamicResource AltBackgroundColor}"
@@ -286,8 +289,11 @@
                     Icon="{StaticResource ZoomAltImage}"
                     IconHeight="16"
                     IconWidth="18"
+                    IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,
+                                                Converter={x:Static ObjectConverters.IsNotNull}}"
                     IsTabStop="False"
-                    Width="35" />
+                    Width="35"
+                    x:Name="ZoomInButton" />
 
                 <customControls:IconButton
                     Background="{DynamicResource MainButtonBackgroundColor}"
@@ -362,7 +368,8 @@
                     Margin="0"
                     ToolTip.Tip="{CompiledBinding Translation.IsFlipped.Value,
                                                   Mode=OneWay}"
-                    Width="35">
+                    Width="35"
+                    x:Name="FlipButton">
                     <Button.RenderTransform>
                         <ScaleTransform ScaleX="{CompiledBinding PicViewer.ScaleX.Value}" />
                     </Button.RenderTransform>

+ 10 - 0
src/PicView.Avalonia/Views/UC/BottomBar.axaml.cs

@@ -112,6 +112,16 @@ public partial class BottomBar : UserControl
 
                 SettingsMenuButton.Classes.Remove("noBorderHover");
                 SettingsMenuButton.Classes.Add("noBorderHoverAlt");
+
+                ZoomOutButton.Classes.Remove("noBorderHover");
+                ZoomInButton.Classes.Remove("noBorderHover");
+                ZoomOutButton.Classes.Add("noBorderHoverAlt");
+                ZoomInButton.Classes.Add("noBorderHoverAlt");
+
+                RotateRightButton.Classes.Remove("noBorderHover");
+                FlipButton.Classes.Remove("noBorderHover");
+                RotateRightButton.Classes.Add("noBorderHoverAlt");
+                FlipButton.Classes.Add("noBorderHoverAlt");
             }
         };
     }

+ 4 - 1
src/PicView.Avalonia/Views/UC/ZoomPreviewer.axaml

@@ -23,17 +23,20 @@
                         Command="{CompiledBinding Tools.ResetZoomCommand}"
                         CornerRadius="6,0,0,0"
                         Data="{StaticResource ReloadGeometry}"
+                        Foreground="{DynamicResource MainTextColor}"
                         Grid.Column="0"
                         Height="22"
                         IconHeight="11"
                         IconWidth="11"
                         Padding="1"
-                        ToolTip.Tip="{CompiledBinding Translation.ResetZoom.Value}" />
+                        ToolTip.Tip="{CompiledBinding Translation.ResetZoom.Value}"
+                        x:Name="ResetZoomButton" />
 
                     <customControls:IconButton
                         Classes="altHover mainBtn"
                         CornerRadius="0,6,0,0"
                         Data="{StaticResource CloseGeometry}"
+                        Foreground="{DynamicResource MainTextColor}"
                         Grid.Column="1"
                         Height="22"
                         IconHeight="10"

+ 10 - 0
src/PicView.Avalonia/Views/UC/ZoomPreviewer.axaml.cs

@@ -29,6 +29,16 @@ public partial class ZoomPreviewer : UserControl
         AddHandler(PointerPressedEvent, OnPointerPressed, RoutingStrategies.Tunnel);
         AddHandler(PointerMovedEvent, OnPointerMoved, RoutingStrategies.Tunnel);
         AddHandler(PointerReleasedEvent, OnPointerReleased, RoutingStrategies.Tunnel);
+
+        if (Settings.Theme.Dark && !Settings.Theme.GlassTheme)
+        {
+            return;
+        }
+
+        ResetZoomButton.Classes.Remove("altHover");
+        CloseButton.Classes.Remove("altHover");
+        ResetZoomButton.Classes.Add("hover");
+        CloseButton.Classes.Add("hover");
     }
 
     protected override void OnGotFocus(GotFocusEventArgs e)