Fix motion bug for macOS

This commit is contained in:
chinboy
2025-07-05 17:41:51 +08:00
parent 57ad0745d1
commit 3fe7404b39
2 changed files with 34 additions and 28 deletions
@@ -73,18 +73,6 @@ namespace AtomUI.Theme.Styling
public static readonly TokenResourceKey TextFontWeight = new TokenResourceKey("Badge.TextFontWeight");
}
public static class ButtonSpinnerTokenKey
{
public static readonly TokenResourceKey ControlWidth = new TokenResourceKey("ButtonSpinner.ControlWidth");
public static readonly TokenResourceKey FilledHandleBg = new TokenResourceKey("ButtonSpinner.FilledHandleBg");
public static readonly TokenResourceKey HandleActiveBg = new TokenResourceKey("ButtonSpinner.HandleActiveBg");
public static readonly TokenResourceKey HandleBg = new TokenResourceKey("ButtonSpinner.HandleBg");
public static readonly TokenResourceKey HandleBorderColor = new TokenResourceKey("ButtonSpinner.HandleBorderColor");
public static readonly TokenResourceKey HandleHoverColor = new TokenResourceKey("ButtonSpinner.HandleHoverColor");
public static readonly TokenResourceKey HandleIconSize = new TokenResourceKey("ButtonSpinner.HandleIconSize");
public static readonly TokenResourceKey HandleWidth = new TokenResourceKey("ButtonSpinner.HandleWidth");
}
public static class ButtonTokenKey
{
public static readonly TokenResourceKey BorderColorDisabled = new TokenResourceKey("Button.BorderColorDisabled");
@@ -136,6 +124,18 @@ namespace AtomUI.Theme.Styling
public static readonly TokenResourceKey TextHoverBg = new TokenResourceKey("Button.TextHoverBg");
}
public static class ButtonSpinnerTokenKey
{
public static readonly TokenResourceKey ControlWidth = new TokenResourceKey("ButtonSpinner.ControlWidth");
public static readonly TokenResourceKey FilledHandleBg = new TokenResourceKey("ButtonSpinner.FilledHandleBg");
public static readonly TokenResourceKey HandleActiveBg = new TokenResourceKey("ButtonSpinner.HandleActiveBg");
public static readonly TokenResourceKey HandleBg = new TokenResourceKey("ButtonSpinner.HandleBg");
public static readonly TokenResourceKey HandleBorderColor = new TokenResourceKey("ButtonSpinner.HandleBorderColor");
public static readonly TokenResourceKey HandleHoverColor = new TokenResourceKey("ButtonSpinner.HandleHoverColor");
public static readonly TokenResourceKey HandleIconSize = new TokenResourceKey("ButtonSpinner.HandleIconSize");
public static readonly TokenResourceKey HandleWidth = new TokenResourceKey("ButtonSpinner.HandleWidth");
}
public static class CalendarTokenKey
{
public static readonly TokenResourceKey CellActiveWithRangeBg = new TokenResourceKey("Calendar.CellActiveWithRangeBg");
+22 -16
View File
@@ -184,6 +184,7 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer
}
SetupPopupHost();
// _buddyDecorator.HideDecoratorContent();
}
public void Detach()
@@ -203,21 +204,17 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer
_buddyDecorator.CaptureContentControl();
_buddyDecorator.Opacity = 0.0d;
_buddyDecorator.NotifySceneShowed();
aboutToStart?.Invoke();
var motion = OpenMotion ?? new ZoomBigInMotion();
if (MotionDuration != TimeSpan.Zero)
{
motion.Duration = MotionDuration;
}
NotifyAboutToRunAttachMotion();
Dispatcher.UIThread.Post(() =>
motion.Run(_buddyDecorator, null, () =>
{
aboutToStart?.Invoke();
motion.Run(_buddyDecorator, null, () =>
{
completedAction?.Invoke();
NotifyAttachMotionCompleted();
});
completedAction?.Invoke();
NotifyAttachMotionCompleted();
});
}
@@ -231,15 +228,18 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer
}
_buddyDecorator.CaptureContentControl();
NotifyAboutToRunDetachMotion();
Dispatcher.UIThread.Post(() =>
{
{
aboutToStart?.Invoke();
motion.Run(_buddyDecorator, null, () =>
Dispatcher.UIThread.Post(() =>
{
completedAction?.Invoke();
NotifyDetachMotionCompleted();
Detach();
motion.Run(_buddyDecorator, null, () =>
{
completedAction?.Invoke();
NotifyDetachMotionCompleted();
Detach();
});
});
});
}
@@ -251,7 +251,10 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer
protected void NotifyAttachMotionCompleted()
{
_buddyDecorator.HideDecoratorContent();
Dispatcher.UIThread.Post(() =>
{
_buddyDecorator.HideDecoratorContent();
});
}
protected void NotifyAboutToRunDetachMotion()
@@ -261,7 +264,10 @@ internal class PopupBuddyLayer : SceneLayer, IPopupBuddyLayer, IShadowAwareLayer
protected void NotifyDetachMotionCompleted()
{
_buddyDecorator.HideDecoratorContent();
Dispatcher.UIThread.Post(() =>
{
_buddyDecorator.HideDecoratorContent();
});
}
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)