mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix Clock/Search Icon show logic
This commit is contained in:
parent
350276dbf5
commit
b9f013e58b
2 changed files with 74 additions and 33 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Media;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -58,7 +59,6 @@ namespace Flow.Launcher
|
|||
|
||||
// Window Animation
|
||||
private const double DefaultRightMargin = 66; //* this value from base.xaml
|
||||
private bool _animating;
|
||||
private bool _isClockPanelAnimating = false;
|
||||
|
||||
// IDisposable
|
||||
|
|
@ -234,7 +234,7 @@ namespace Flow.Launcher
|
|||
|
||||
// Detect History.Visibility changes
|
||||
DependencyPropertyDescriptor
|
||||
.FromProperty(VisibilityProperty, typeof(StackPanel)) // History는 StackPanel이라고 가정
|
||||
.FromProperty(VisibilityProperty, typeof(StackPanel))
|
||||
.AddValueChanged(History, (s, e) => UpdateClockPanelVisibility());
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +269,6 @@ namespace Flow.Launcher
|
|||
|
||||
private void OnLocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_animating) return;
|
||||
|
||||
if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
|
||||
{
|
||||
|
|
@ -592,7 +591,7 @@ namespace Flow.Launcher
|
|||
|
||||
private void UpdatePosition(bool force)
|
||||
{
|
||||
if (_animating && !force)
|
||||
if (!force)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -768,18 +767,20 @@ namespace Flow.Launcher
|
|||
_viewModel.ProgressBarVisibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
private void WindowAnimation()
|
||||
public void WindowAnimation()
|
||||
{
|
||||
if (_animating)
|
||||
return;
|
||||
|
||||
_isArrowKeyPressed = true;
|
||||
_animating = true;
|
||||
UpdatePosition(false);
|
||||
|
||||
ClockPanel.Opacity = 0;
|
||||
SearchIcon.Opacity = 0;
|
||||
|
||||
if(_settings.UseAnimation)
|
||||
{
|
||||
ClockPanel.Opacity = 0;
|
||||
SearchIcon.Opacity = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClockPanel.Opacity = 1;
|
||||
SearchIcon.Opacity = 1;
|
||||
}
|
||||
var clocksb = new Storyboard();
|
||||
var iconsb = new Storyboard();
|
||||
CircleEase easing = new CircleEase { EasingMode = EasingMode.EaseInOut };
|
||||
|
|
@ -848,16 +849,11 @@ namespace Flow.Launcher
|
|||
clocksb.Children.Add(ClockOpacity);
|
||||
iconsb.Children.Add(IconMotion);
|
||||
iconsb.Children.Add(IconOpacity);
|
||||
|
||||
clocksb.Completed += (_, _) => _animating = false;
|
||||
|
||||
_settings.WindowLeft = Left;
|
||||
_isArrowKeyPressed = false;
|
||||
|
||||
if (QueryTextBox.Text.Length == 0)
|
||||
{
|
||||
clocksb.Begin(ClockPanel);
|
||||
}
|
||||
|
||||
|
||||
clocksb.Begin(ClockPanel);
|
||||
iconsb.Begin(SearchIcon);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Windows.Input;
|
||||
using System.Linq;
|
||||
|
|
@ -1437,11 +1438,43 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
// 📌 Remove DWM Cloak (Make the window visible normally)
|
||||
Win32Helper.DWMSetCloakForWindow(mainWindow, false);
|
||||
|
||||
//Clock and SearchIcon hide when show situation
|
||||
if(Settings.UseAnimation)
|
||||
{
|
||||
mainWindow.ClockPanel.Opacity = 0;
|
||||
mainWindow.SearchIcon.Opacity = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow.ClockPanel.Opacity = 1;
|
||||
mainWindow.SearchIcon.Opacity = 1;
|
||||
}
|
||||
|
||||
if (mainWindow.QueryTextBox.Text.Length != 0)
|
||||
{
|
||||
mainWindow.ClockPanel.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow.ClockPanel.Visibility = Visibility.Visible;
|
||||
}
|
||||
if (PluginIconSource != null)
|
||||
{
|
||||
mainWindow.SearchIcon.Opacity = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchIconVisibility = Visibility.Visible;
|
||||
}
|
||||
// 📌 Restore UI elements
|
||||
mainWindow.ClockPanel.Visibility = Visibility.Visible;
|
||||
//mainWindow.SearchIcon.Visibility = Visibility.Visible;
|
||||
SearchIconVisibility = Visibility.Visible;
|
||||
if (Settings.UseAnimation)
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(() =>
|
||||
mainWindow.WindowAnimation());
|
||||
Debug.WriteLine("Call Animation");
|
||||
}
|
||||
}
|
||||
|
||||
// Update WPF properties
|
||||
|
|
@ -1474,15 +1507,19 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
|
||||
// 📌 Immediately apply text reset + force UI update
|
||||
if (Settings.LastQueryMode == LastQueryMode.Empty)
|
||||
/*if (Settings.LastQueryMode == LastQueryMode.Empty)
|
||||
{
|
||||
ChangeQueryText(string.Empty);
|
||||
await Task.Delay(1); // Wait for one frame to ensure UI reflects changes
|
||||
Application.Current.Dispatcher.Invoke(Application.Current.MainWindow.UpdateLayout); // Force UI update
|
||||
}
|
||||
}*/
|
||||
|
||||
switch (Settings.LastQueryMode)
|
||||
{
|
||||
case LastQueryMode.Empty:
|
||||
ChangeQueryText(string.Empty);
|
||||
await Task.Delay(1);
|
||||
break;
|
||||
case LastQueryMode.Preserved:
|
||||
case LastQueryMode.Selected:
|
||||
LastQuerySelected = (Settings.LastQueryMode == LastQueryMode.Preserved);
|
||||
|
|
@ -1504,18 +1541,26 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
// 📌 Set Opacity of icon and clock to 0 and apply Visibility.Hidden
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
|
||||
}, DispatcherPriority.Render);
|
||||
if(Settings.UseAnimation)
|
||||
{
|
||||
mainWindow.ClockPanel.Opacity = 0;
|
||||
mainWindow.SearchIcon.Opacity = 0;
|
||||
mainWindow.ClockPanel.Visibility = Visibility.Hidden;
|
||||
//mainWindow.SearchIcon.Visibility = Visibility.Hidden;
|
||||
SearchIconVisibility = Visibility.Hidden;
|
||||
|
||||
// Force UI update
|
||||
mainWindow.ClockPanel.UpdateLayout();
|
||||
mainWindow.SearchIcon.UpdateLayout();
|
||||
}, DispatcherPriority.Render);
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow.ClockPanel.Opacity = 1;
|
||||
mainWindow.SearchIcon.Opacity = 1;
|
||||
}
|
||||
mainWindow.ClockPanel.Visibility = Visibility.Hidden;
|
||||
//mainWindow.SearchIcon.Visibility = Visibility.Hidden;
|
||||
SearchIconVisibility = Visibility.Hidden;
|
||||
|
||||
// Force UI update
|
||||
mainWindow.ClockPanel.UpdateLayout();
|
||||
mainWindow.SearchIcon.UpdateLayout();
|
||||
// 📌 Apply DWM Cloak (Completely hide the window)
|
||||
Win32Helper.DWMSetCloakForWindow(mainWindow, true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue