Skip to content

Commit

Permalink
add icons indicating that there is more when scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
flustix committed Jul 10, 2024
1 parent 0b6c644 commit f310386
Showing 1 changed file with 64 additions and 7 deletions.
71 changes: 64 additions & 7 deletions fluXis.Game/Screens/Edit/Tabs/Shared/Points/List/PointsList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ public abstract partial class PointsList : Container
public Action RequestClose { get; set; }

private bool initialLoad = true;
private FluXisScrollContainer scroll;
private FillFlowContainer<PointListEntry> flow;

private SpriteIcon iconUp;
private bool iconUpShown;
private SpriteIcon iconDown;
private bool iconDownShown;

[BackgroundDependencyLoader]
private void load()
{
Expand Down Expand Up @@ -83,16 +89,40 @@ private void load()
new[] { Empty() },
new Drawable[]
{
new FluXisScrollContainer
new Container
{
RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false,
Child = flow = new FillFlowContainer<PointListEntry>
Padding = new MarginPadding { Bottom = 10 },
Children = new Drawable[]
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(8)
scroll = new FluXisScrollContainer
{
RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false,
Child = flow = new FillFlowContainer<PointListEntry>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(8)
}
},
iconUp = new SpriteIcon
{
Icon = FontAwesome6.Solid.ChevronUp,
Size = new Vector2(16),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Alpha = 0
},
iconDown = new SpriteIcon
{
Icon = FontAwesome6.Solid.ChevronDown,
Size = new Vector2(16),
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Alpha = 0
}
}
}
}
Expand Down Expand Up @@ -224,6 +254,33 @@ protected void RemovePoint(ITimedObject obj)
flow.Remove(entry, true);
}

protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();

if (!scroll.IsScrolledToStart() && !iconUpShown)
{
iconUpShown = true;
iconUp.FadeIn(300);
}
else if (scroll.IsScrolledToStart() && iconUpShown)
{
iconUpShown = false;
iconUp.FadeOut(300);
}

if (!scroll.IsScrolledToEnd() && !iconDownShown)
{
iconDownShown = true;
iconDown.FadeIn(300);
}
else if (scroll.IsScrolledToEnd() && iconDownShown)
{
iconDownShown = false;
iconDown.FadeOut(300);
}
}

protected override bool OnClick(ClickEvent e) => true;

private partial class AddButton : PointsListIconButton, IHasPopover
Expand Down

0 comments on commit f310386

Please sign in to comment.