@@ -58,7 +58,6 @@ public partial class MainWindow : IDisposable
5858
5959 // Window Animation
6060 private const double DefaultRightMargin = 66 ; //* this value from base.xaml
61- private bool _animating ;
6261 private bool _isClockPanelAnimating = false ;
6362
6463 // IDisposable
@@ -76,7 +75,7 @@ public MainWindow()
7675 DataContext = _viewModel ;
7776
7877 InitializeComponent ( ) ;
79- UpdatePosition ( true ) ;
78+ UpdatePosition ( ) ;
8079
8180 InitSoundEffects ( ) ;
8281 DataObject . AddPastingHandler ( QueryTextBox , QueryTextBox_OnPaste ) ;
@@ -112,7 +111,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
112111 }
113112
114113 // Hide window if need
115- UpdatePosition ( true ) ;
114+ UpdatePosition ( ) ;
116115 if ( _settings . HideOnStartup )
117116 {
118117 _viewModel . Hide ( ) ;
@@ -139,7 +138,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
139138 InitProgressbarAnimation ( ) ;
140139
141140 // Force update position
142- UpdatePosition ( true ) ;
141+ UpdatePosition ( ) ;
143142
144143 // Refresh frame
145144 await Ioc . Default . GetRequiredService < Theme > ( ) . RefreshFrameAsync ( ) ;
@@ -167,7 +166,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
167166 SoundPlay ( ) ;
168167 }
169168
170- UpdatePosition ( false ) ;
169+ UpdatePosition ( ) ;
171170 _viewModel . ResetPreview ( ) ;
172171 Activate ( ) ;
173172 QueryTextBox . Focus ( ) ;
@@ -234,7 +233,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
234233
235234 // Detect History.Visibility changes
236235 DependencyPropertyDescriptor
237- . FromProperty ( VisibilityProperty , typeof ( StackPanel ) ) // History는 StackPanel이라고 가정
236+ . FromProperty ( VisibilityProperty , typeof ( StackPanel ) )
238237 . AddValueChanged ( History , ( s , e ) => UpdateClockPanelVisibility ( ) ) ;
239238 }
240239
@@ -269,8 +268,6 @@ private void OnClosed(object sender, EventArgs e)
269268
270269 private void OnLocationChanged ( object sender , EventArgs e )
271270 {
272- if ( _animating ) return ;
273-
274271 if ( _settings . SearchWindowScreen == SearchWindowScreens . RememberLastLaunchLocation )
275272 {
276273 _settings . WindowLeft = Left ;
@@ -282,17 +279,18 @@ private async void OnDeactivated(object sender, EventArgs e)
282279 {
283280 _settings . WindowLeft = Left ;
284281 _settings . WindowTop = Top ;
282+
285283 ClockPanel . Opacity = 0 ;
286284 SearchIcon . Opacity = 0 ;
287- //This condition stops extra hide call when animator is on,
285+
286+ // This condition stops extra hide call when animator is on,
288287 // which causes the toggling to occasional hide instead of show.
289288 if ( _viewModel . MainWindowVisibilityStatus )
290289 {
291290 // Need time to initialize the main query window animation.
292291 // This also stops the mainwindow from flickering occasionally after Settings window is opened
293292 // and always after Settings window is closed.
294293 if ( _settings . UseAnimation )
295-
296294 await Task . Delay ( 100 ) ;
297295
298296 if ( _settings . HideWhenDeactivated && ! _viewModel . ExternalPreviewVisible )
@@ -590,13 +588,8 @@ private void UpdateNotifyIconText()
590588
591589 #region Window Position
592590
593- private void UpdatePosition ( bool force )
591+ private void UpdatePosition ( )
594592 {
595- if ( _animating && ! force )
596- {
597- return ;
598- }
599-
600593 // Initialize call twice to work around multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910
601594 InitializePosition ( ) ;
602595 InitializePosition ( ) ;
@@ -770,19 +763,17 @@ private void InitProgressbarAnimation()
770763
771764 private void WindowAnimation ( )
772765 {
773- if ( _animating )
774- return ;
775-
776766 _isArrowKeyPressed = true ;
777- _animating = true ;
778- UpdatePosition ( false ) ;
779767
780- ClockPanel . Opacity = 0 ;
781- SearchIcon . Opacity = 0 ;
782-
768+ UpdatePosition ( ) ;
769+
770+ var opacity = _settings . UseAnimation ? 0.0 : 1.0 ;
771+ ClockPanel . Opacity = opacity ;
772+ SearchIcon . Opacity = opacity ;
773+
783774 var clocksb = new Storyboard ( ) ;
784775 var iconsb = new Storyboard ( ) ;
785- CircleEase easing = new CircleEase { EasingMode = EasingMode . EaseInOut } ;
776+ var easing = new CircleEase { EasingMode = EasingMode . EaseInOut } ;
786777
787778 var animationLength = _settings . AnimationSpeed switch
788779 {
@@ -810,7 +801,7 @@ private void WindowAnimation()
810801 FillBehavior = FillBehavior . HoldEnd
811802 } ;
812803
813- double TargetIconOpacity = GetOpacityFromStyle ( SearchIcon . Style , 1.0 ) ;
804+ var TargetIconOpacity = GetOpacityFromStyle ( SearchIcon . Style , 1.0 ) ;
814805
815806 var IconOpacity = new DoubleAnimation
816807 {
@@ -821,7 +812,7 @@ private void WindowAnimation()
821812 FillBehavior = FillBehavior . HoldEnd
822813 } ;
823814
824- double rightMargin = GetThicknessFromStyle ( ClockPanel . Style , new Thickness ( 0 , 0 , DefaultRightMargin , 0 ) ) . Right ;
815+ var rightMargin = GetThicknessFromStyle ( ClockPanel . Style , new Thickness ( 0 , 0 , DefaultRightMargin , 0 ) ) . Right ;
825816
826817 var thicknessAnimation = new ThicknessAnimation
827818 {
@@ -848,16 +839,11 @@ private void WindowAnimation()
848839 clocksb . Children . Add ( ClockOpacity ) ;
849840 iconsb . Children . Add ( IconMotion ) ;
850841 iconsb . Children . Add ( IconOpacity ) ;
851-
852- clocksb . Completed += ( _ , _ ) => _animating = false ;
842+
853843 _settings . WindowLeft = Left ;
854844 _isArrowKeyPressed = false ;
855-
856- if ( QueryTextBox . Text . Length == 0 )
857- {
858- clocksb . Begin ( ClockPanel ) ;
859- }
860-
845+
846+ clocksb . Begin ( ClockPanel ) ;
861847 iconsb . Begin ( SearchIcon ) ;
862848 }
863849
0 commit comments