@@ -58,7 +58,6 @@ public partial class MainWindow : IDisposable
58
58
59
59
// Window Animation
60
60
private const double DefaultRightMargin = 66 ; //* this value from base.xaml
61
- private bool _animating ;
62
61
private bool _isClockPanelAnimating = false ;
63
62
64
63
// IDisposable
@@ -76,7 +75,7 @@ public MainWindow()
76
75
DataContext = _viewModel ;
77
76
78
77
InitializeComponent ( ) ;
79
- UpdatePosition ( true ) ;
78
+ UpdatePosition ( ) ;
80
79
81
80
InitSoundEffects ( ) ;
82
81
DataObject . AddPastingHandler ( QueryTextBox , QueryTextBox_OnPaste ) ;
@@ -112,7 +111,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
112
111
}
113
112
114
113
// Hide window if need
115
- UpdatePosition ( true ) ;
114
+ UpdatePosition ( ) ;
116
115
if ( _settings . HideOnStartup )
117
116
{
118
117
_viewModel . Hide ( ) ;
@@ -139,7 +138,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
139
138
InitProgressbarAnimation ( ) ;
140
139
141
140
// Force update position
142
- UpdatePosition ( true ) ;
141
+ UpdatePosition ( ) ;
143
142
144
143
// Refresh frame
145
144
await Ioc . Default . GetRequiredService < Theme > ( ) . RefreshFrameAsync ( ) ;
@@ -167,7 +166,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
167
166
SoundPlay ( ) ;
168
167
}
169
168
170
- UpdatePosition ( false ) ;
169
+ UpdatePosition ( ) ;
171
170
_viewModel . ResetPreview ( ) ;
172
171
Activate ( ) ;
173
172
QueryTextBox . Focus ( ) ;
@@ -234,7 +233,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
234
233
235
234
// Detect History.Visibility changes
236
235
DependencyPropertyDescriptor
237
- . FromProperty ( VisibilityProperty , typeof ( StackPanel ) ) // History는 StackPanel이라고 가정
236
+ . FromProperty ( VisibilityProperty , typeof ( StackPanel ) )
238
237
. AddValueChanged ( History , ( s , e ) => UpdateClockPanelVisibility ( ) ) ;
239
238
}
240
239
@@ -269,8 +268,6 @@ private void OnClosed(object sender, EventArgs e)
269
268
270
269
private void OnLocationChanged ( object sender , EventArgs e )
271
270
{
272
- if ( _animating ) return ;
273
-
274
271
if ( _settings . SearchWindowScreen == SearchWindowScreens . RememberLastLaunchLocation )
275
272
{
276
273
_settings . WindowLeft = Left ;
@@ -282,17 +279,18 @@ private async void OnDeactivated(object sender, EventArgs e)
282
279
{
283
280
_settings . WindowLeft = Left ;
284
281
_settings . WindowTop = Top ;
282
+
285
283
ClockPanel . Opacity = 0 ;
286
284
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,
288
287
// which causes the toggling to occasional hide instead of show.
289
288
if ( _viewModel . MainWindowVisibilityStatus )
290
289
{
291
290
// Need time to initialize the main query window animation.
292
291
// This also stops the mainwindow from flickering occasionally after Settings window is opened
293
292
// and always after Settings window is closed.
294
293
if ( _settings . UseAnimation )
295
-
296
294
await Task . Delay ( 100 ) ;
297
295
298
296
if ( _settings . HideWhenDeactivated && ! _viewModel . ExternalPreviewVisible )
@@ -590,13 +588,8 @@ private void UpdateNotifyIconText()
590
588
591
589
#region Window Position
592
590
593
- private void UpdatePosition ( bool force )
591
+ private void UpdatePosition ( )
594
592
{
595
- if ( _animating && ! force )
596
- {
597
- return ;
598
- }
599
-
600
593
// Initialize call twice to work around multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910
601
594
InitializePosition ( ) ;
602
595
InitializePosition ( ) ;
@@ -770,19 +763,17 @@ private void InitProgressbarAnimation()
770
763
771
764
private void WindowAnimation ( )
772
765
{
773
- if ( _animating )
774
- return ;
775
-
776
766
_isArrowKeyPressed = true ;
777
- _animating = true ;
778
- UpdatePosition ( false ) ;
779
767
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
+
783
774
var clocksb = new Storyboard ( ) ;
784
775
var iconsb = new Storyboard ( ) ;
785
- CircleEase easing = new CircleEase { EasingMode = EasingMode . EaseInOut } ;
776
+ var easing = new CircleEase { EasingMode = EasingMode . EaseInOut } ;
786
777
787
778
var animationLength = _settings . AnimationSpeed switch
788
779
{
@@ -810,7 +801,7 @@ private void WindowAnimation()
810
801
FillBehavior = FillBehavior . HoldEnd
811
802
} ;
812
803
813
- double TargetIconOpacity = GetOpacityFromStyle ( SearchIcon . Style , 1.0 ) ;
804
+ var TargetIconOpacity = GetOpacityFromStyle ( SearchIcon . Style , 1.0 ) ;
814
805
815
806
var IconOpacity = new DoubleAnimation
816
807
{
@@ -821,7 +812,7 @@ private void WindowAnimation()
821
812
FillBehavior = FillBehavior . HoldEnd
822
813
} ;
823
814
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 ;
825
816
826
817
var thicknessAnimation = new ThicknessAnimation
827
818
{
@@ -848,16 +839,11 @@ private void WindowAnimation()
848
839
clocksb . Children . Add ( ClockOpacity ) ;
849
840
iconsb . Children . Add ( IconMotion ) ;
850
841
iconsb . Children . Add ( IconOpacity ) ;
851
-
852
- clocksb . Completed += ( _ , _ ) => _animating = false ;
842
+
853
843
_settings . WindowLeft = Left ;
854
844
_isArrowKeyPressed = false ;
855
-
856
- if ( QueryTextBox . Text . Length == 0 )
857
- {
858
- clocksb . Begin ( ClockPanel ) ;
859
- }
860
-
845
+
846
+ clocksb . Begin ( ClockPanel ) ;
861
847
iconsb . Begin ( SearchIcon ) ;
862
848
}
863
849
0 commit comments