1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Disallow flinging when not in toast state

This commit is contained in:
Dean Herbert 2022-09-11 21:34:35 +09:00
parent d6f90e3b9f
commit b5a2f7003e
2 changed files with 12 additions and 2 deletions

View File

@ -158,7 +158,10 @@ namespace osu.Game.Overlays
playDebouncedSample(notification.PopInSampleName);
if (State.Value == Visibility.Hidden)
{
notification.IsInTray = true;
toastTray.Post(notification);
}
else
addPermanently(notification);
@ -167,6 +170,8 @@ namespace osu.Game.Overlays
private void addPermanently(Notification notification)
{
notification.IsInTray = false;
var ourType = notification.GetType();
int depth = notification.DisplayOnTop ? -runningDepth : runningDepth;

View File

@ -68,6 +68,11 @@ namespace osu.Game.Overlays.Notifications
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
/// <summary>
/// Whether this notification is in the <see cref="NotificationOverlayToastTray"/>.
/// </summary>
public bool IsInTray { get; set; }
private readonly Box initialFlash;
private Box background = null!;
@ -262,7 +267,7 @@ namespace osu.Game.Overlays.Notifications
}
}
protected override bool OnDragStart(DragStartEvent e) => true;
protected override bool OnDragStart(DragStartEvent e) => notification.IsInTray;
protected override void OnDrag(DragEvent e)
{
@ -326,7 +331,7 @@ namespace osu.Game.Overlays.Notifications
public bool FlingLeft()
{
if (this.FindClosestParent<NotificationOverlayToastTray>() == null)
if (!notification.IsInTray)
return false;
if (flinging)