fix NotificationOverlay going out of bounds at the bottom

also fixes the overlap with the Toolbar at the top
This commit is contained in:
Aergwyn
2017-12-23 14:33:43 +01:00
parent 7956a284a5
commit 9bb0cda525
3 changed files with 42 additions and 35 deletions

View File

@ -10,6 +10,7 @@ using osu.Game.Overlays.Notifications;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
using System;
namespace osu.Game.Overlays
{
@ -19,9 +20,13 @@ namespace osu.Game.Overlays
public const float TRANSITION_LENGTH = 600;
private ScrollContainer scrollContainer;
private FlowContainer<NotificationSection> sections;
/// <summary>
/// Provide a source for the toolbar height.
/// </summary>
public Func<float> GetToolbarHeight;
[BackgroundDependencyLoader]
private void load()
{
@ -36,12 +41,12 @@ namespace osu.Game.Overlays
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.6f,
Alpha = 0.6f
},
scrollContainer = new OsuScrollContainer
new OsuScrollContainer
{
Masking = true,
RelativeSizeAxes = Axes.Both,
Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT },
Children = new[]
{
sections = new FillFlowContainer<NotificationSection>
@ -55,14 +60,14 @@ namespace osu.Game.Overlays
{
Title = @"Notifications",
ClearText = @"Clear All",
AcceptTypes = new[] { typeof(SimpleNotification) },
AcceptTypes = new[] { typeof(SimpleNotification) }
},
new NotificationSection
{
Title = @"Running Tasks",
ClearText = @"Cancel All",
AcceptTypes = new[] { typeof(ProgressNotification) },
},
AcceptTypes = new[] { typeof(ProgressNotification) }
}
}
}
}
@ -103,14 +108,8 @@ namespace osu.Game.Overlays
{
base.PopIn();
scrollContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
this.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(1, TRANSITION_LENGTH / 2);
}
private void markAllRead()
{
sections.Children.ForEach(s => s.MarkAllRead());
this.FadeTo(1, TRANSITION_LENGTH, Easing.OutQuint);
}
protected override void PopOut()
@ -120,7 +119,19 @@ namespace osu.Game.Overlays
markAllRead();
this.MoveToX(width, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(0, TRANSITION_LENGTH / 2);
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
}
private void markAllRead()
{
sections.Children.ForEach(s => s.MarkAllRead());
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
}
}
}