Skip to content

Commit

Permalink
Adjust the panel:
Browse files Browse the repository at this point in the history
1. poanel should not block the editor.
2. adjust the panel style.
  • Loading branch information
andy840119 committed Aug 15, 2024
1 parent 423d486 commit 4872f11
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,38 @@ public abstract partial class Panel : FocusedOverlayContainer
protected virtual string PopOutSampleName => "UI/overlay-pop-out";

private readonly IBindable<LyricEditorMode> bindableMode = new Bindable<LyricEditorMode>();

private readonly Box background;
private readonly FillFlowContainer fillFlowContainer;

protected override bool BlockPositionalInput => false;

protected Panel()
{
RelativeSizeAxes = Axes.Y;
Padding = new MarginPadding(10);

InternalChildren = new Drawable[]
InternalChild = new Container
{
background = new Box
{
Name = "Background",
RelativeSizeAxes = Axes.Both,
},
new OsuScrollContainer
Masking = true,
CornerRadius = 10,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
RelativeSizeAxes = Axes.Both,
Child = fillFlowContainer = new FillFlowContainer
background = new Box
{
Name = "Background",
RelativeSizeAxes = Axes.Both,
Alpha = 0.6f,
},
new OsuScrollContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(10),
RelativeSizeAxes = Axes.Both,
Child = fillFlowContainer = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(10),
},
},
},
};
Expand Down Expand Up @@ -85,32 +93,25 @@ public PanelDirection Direction
switch (direction)
{
case PanelDirection.Left:
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
Anchor = Anchor.TopLeft;
Origin = Anchor.TopLeft;
break;

case PanelDirection.Right:
Anchor = Anchor.CentreRight;
Origin = Anchor.CentreRight;
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
break;

default:
throw new ArgumentOutOfRangeException(nameof(direction));
}

if (State.Value == Visibility.Hidden)
{
X = getHideXPosition();
}
}
}

protected override void PopIn()
{
samplePopIn?.Play();

// todo: adjust the effect.
this.MoveToX(0, transition_length, Easing.OutQuint);
this.FadeTo(1, transition_length, Easing.OutQuint);

// should load the content after opened.
Expand All @@ -121,20 +122,10 @@ protected override void PopOut()
{
samplePopOut?.Play();

float width = getHideXPosition();
this.MoveToX(width, transition_length, Easing.OutQuint);
this.FadeTo(0, transition_length, Easing.OutQuint).OnComplete(_ =>
{
// should clear the content if close.
fillFlowContainer.Clear();
});
}

private float getHideXPosition() =>
direction switch
{
PanelDirection.Left => -DrawWidth,
PanelDirection.Right => DrawWidth,
_ => throw new ArgumentOutOfRangeException(),
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public partial class InvalidPanel : Panel
public InvalidPanel()
{
Width = 200;
Height = 300;
}

protected override IReadOnlyList<Drawable> CreateSections() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public partial class PropertyPanel : Panel
public PropertyPanel()
{
Width = 200;
RelativeSizeAxes = Axes.Y;
}

protected override IReadOnlyList<Drawable> CreateSections()
Expand Down

0 comments on commit 4872f11

Please sign in to comment.