@@ -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
0 commit comments