Skip to content

Commit 7c8d45d

Browse files
committed
- Fix Clock Right margin
- Style Cleanup
1 parent d90b82a commit 7c8d45d

File tree

2 files changed

+27
-35
lines changed

2 files changed

+27
-35
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ public void ResetAnimation()
505505
windowsb?.Stop(FlowMainWindow);
506506

507507
// UI 요소 상태 초기화
508-
ClockPanel.Margin = new Thickness(0, 0, ClockPanel.Margin.Right, 0);
508+
//ClockPanel.Margin = new Thickness(0, 0, ClockPanel.Margin.Right, 0);
509509
ClockPanel.Opacity = 0;
510510
SearchIcon.Opacity = 0;
511511
}
@@ -540,11 +540,10 @@ public void WindowAnimator()
540540
FillBehavior = FillBehavior.Stop
541541
};
542542

543-
// 📌 항상 같은 위치에서 시작하도록 `_originalTop`을 사용
544543
var WindowMotion = new DoubleAnimation
545544
{
546-
From = Top, // 원래 위치에서 10px 내려온 후
547-
To = Top, // 다시 원래 위치로 이동
545+
From = Top,
546+
To = Top,
548547
Duration = TimeSpan.FromMilliseconds(animationLength * 2 / 3),
549548
FillBehavior = FillBehavior.Stop
550549
};
@@ -567,9 +566,8 @@ public void WindowAnimator()
567566
FillBehavior = FillBehavior.HoldEnd
568567
};
569568

570-
double TargetIconOpacity = GetOpacityFromStyle(SearchIcon, SearchIcon.Style, 1.0); // 스타일에서 Opacity 가져오기
571-
572-
System.Diagnostics.Debug.WriteLine("스타일에서 가져온 투명도: " + TargetIconOpacity);
569+
double TargetIconOpacity = GetOpacityFromStyle(SearchIcon, SearchIcon.Style, 1.0);
570+
573571

574572
var IconOpacity = new DoubleAnimation
575573
{
@@ -580,17 +578,18 @@ public void WindowAnimator()
580578
FillBehavior = FillBehavior.HoldEnd
581579
};
582580

583-
double right = ClockPanel.Margin.Right;
581+
const double DefaultRightMargin = 66; //* this value from base.xaml
582+
double rightMargin = GetThicknessFromStyle(ClockPanel, ClockPanel.Style, new Thickness(0, 0, DefaultRightMargin, 0)).Right;
583+
584584
var thicknessAnimation = new ThicknessAnimation
585585
{
586-
From = new Thickness(0, 12, right, 0),
587-
To = new Thickness(0, 0, right, 0),
586+
From = new Thickness(0, 12, rightMargin, 0),
587+
To = new Thickness(0, 0, rightMargin, 0),
588588
EasingFunction = easing,
589589
Duration = TimeSpan.FromMilliseconds(animationLength),
590590
FillBehavior = FillBehavior.HoldEnd
591591
};
592592

593-
// 애니메이션 타겟 설정
594593
Storyboard.SetTargetProperty(ClockOpacity, new PropertyPath(OpacityProperty));
595594
Storyboard.SetTarget(ClockOpacity, ClockPanel);
596595

@@ -609,7 +608,6 @@ public void WindowAnimator()
609608
Storyboard.SetTarget(IconOpacity, SearchIcon);
610609
Storyboard.SetTargetProperty(IconOpacity, new PropertyPath(OpacityProperty));
611610

612-
// 스토리보드에 애니메이션 추가
613611
clocksb.Children.Add(thicknessAnimation);
614612
clocksb.Children.Add(ClockOpacity);
615613
windowsb.Children.Add(WindowOpacity);
@@ -646,6 +644,23 @@ private double GetOpacityFromStyle(UIElement element, Style style, double defaul
646644
return defaultOpacity;
647645
}
648646

647+
private Thickness GetThicknessFromStyle(UIElement element, Style style, Thickness defaultThickness)
648+
{
649+
if (style == null)
650+
return defaultThickness;
651+
652+
foreach (Setter setter in style.Setters)
653+
{
654+
if (setter.Property == FrameworkElement.MarginProperty)
655+
{
656+
return setter.Value is Thickness thickness ? thickness : defaultThickness;
657+
}
658+
}
659+
660+
return defaultThickness;
661+
}
662+
663+
649664

650665
private bool _isClockPanelAnimating = false; // 애니메이션 실행 중인지 여부
651666

Flow.Launcher/Themes/Base.xaml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -165,29 +165,6 @@
165165
BasedOn="{StaticResource BaseClockPanel}"
166166
TargetType="{x:Type StackPanel}">
167167
<Setter Property="Orientation" Value="Vertical" />
168-
<!--<Setter Property="Visibility" Value="Collapsed" />
169-
<Style.Triggers>
170-
<MultiDataTrigger>
171-
<MultiDataTrigger.Conditions>
172-
<Condition Binding="{Binding ElementName=QueryTextBox, UpdateSourceTrigger=PropertyChanged, Path=Text.Length}" Value="0" />
173-
<Condition Binding="{Binding ElementName=ContextMenu, Path=Visibility}" Value="Collapsed" />
174-
<Condition Binding="{Binding ElementName=History, Path=Visibility}" Value="Collapsed" />
175-
</MultiDataTrigger.Conditions>
176-
<Setter Property="Visibility" Value="Visible" />
177-
<MultiDataTrigger.EnterActions>
178-
<BeginStoryboard>
179-
<Storyboard>
180-
<DoubleAnimation
181-
Storyboard.TargetProperty="Opacity"
182-
From="0.0"
183-
To="1"
184-
Duration="0:0:0.25" />
185-
</Storyboard>
186-
</BeginStoryboard>
187-
</MultiDataTrigger.EnterActions>
188-
</MultiDataTrigger>
189-
</Style.Triggers>-->
190-
191168
</Style>
192169

193170
<!-- Item Style -->

0 commit comments

Comments
 (0)