Procházet zdrojové kódy

Better tooltip display for showing zooming percentage

Ruben před 10 měsíci
rodič
revize
bf80e13fdf

+ 9 - 2
src/PicView.Avalonia/Views/ImageViewer.axaml.cs

@@ -295,7 +295,14 @@ public partial class ImageViewer : UserControl
         }
         else
         {
-            ZoomTo(point, currentZoom, true);
+            if (currentZoom is > 0.95 and < 1.05 or > 1.0 and < 1.05)
+            {
+                ResetZoom(true);
+            }
+            else
+            {
+                ZoomTo(point, currentZoom, true);
+            }
         }
     }
 
@@ -342,7 +349,7 @@ public partial class ImageViewer : UserControl
         if (_isZoomed)
         {
             SetTitleHelper.SetTitle(vm);
-            TooltipHelper.ShowTooltipMessage($"{Math.Floor(zoomValue * 100)}%", center: true);
+            _ = TooltipHelper.ShowTooltipMessageAsync($"{Math.Floor(zoomValue * 100)}%", center: true, TimeSpan.FromSeconds(1));
         }
     }
 

+ 0 - 5
src/PicView.Avalonia/Views/UC/ToolTipMessage.axaml

@@ -14,11 +14,6 @@
     <Design.DataContext>
         <viewModels:MainViewModel />
     </Design.DataContext>
-    <UserControl.Transitions>
-        <Transitions>
-            <DoubleTransition Duration="0:0:1.75" Property="Opacity" />
-        </Transitions>
-    </UserControl.Transitions>
     <Border
         Background="{DynamicResource SecondaryBackgroundColor}"
         BorderBrush="{DynamicResource MainBorderColor}"