Proper dropdown expansion, DisplayModeToggleButton -> DisplayStyleToggleButton

This commit is contained in:
DrabWeb
2017-05-19 18:32:04 -03:00
parent 05b8fc5126
commit 2f10b72cb2

View File

@ -46,10 +46,12 @@ namespace osu.Game.Overlays.Direct
set { resultCounts = value; updateResultCounts(); } set { resultCounts = value; updateResultCounts(); }
} }
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || RankStatusDropdown.Contains(screenSpacePos);
public FilterControl() public FilterControl()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; Height = 35 + 32 + 30 + (padding * 2); // search + mode toggle buttons + sort tabs + padding
DisplayStyle.Value = PanelDisplayStyle.Grid; DisplayStyle.Value = PanelDisplayStyle.Grid;
Children = new Drawable[] Children = new Drawable[]
@ -95,11 +97,11 @@ namespace osu.Game.Overlays.Direct
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight, Anchor = Anchor.TopRight,
Origin = Anchor.BottomRight, Origin = Anchor.TopRight,
Spacing = new Vector2(10f, 0f), Spacing = new Vector2(10f, 0f),
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Margin = new MarginPadding { Bottom = 5, Right = DirectOverlay.WIDTH_PADDING }, Margin = new MarginPadding { Top = Height - 25 - padding, Right = DirectOverlay.WIDTH_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer
@ -109,8 +111,8 @@ namespace osu.Game.Overlays.Direct
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Children = new[] Children = new[]
{ {
new DisplayModeToggleButton(FontAwesome.fa_th_large, PanelDisplayStyle.Grid, DisplayStyle), new DisplayStyleToggleButton(FontAwesome.fa_th_large, PanelDisplayStyle.Grid, DisplayStyle),
new DisplayModeToggleButton(FontAwesome.fa_list_ul, PanelDisplayStyle.List, DisplayStyle), new DisplayStyleToggleButton(FontAwesome.fa_list_ul, PanelDisplayStyle.List, DisplayStyle),
}, },
}, },
RankStatusDropdown = new SlimEnumDropdown<RankStatus> RankStatusDropdown = new SlimEnumDropdown<RankStatus>
@ -243,16 +245,16 @@ namespace osu.Game.Overlays.Direct
} }
} }
private class DisplayModeToggleButton : ClickableContainer private class DisplayStyleToggleButton : ClickableContainer
{ {
private readonly TextAwesome icon; private readonly TextAwesome icon;
private readonly PanelDisplayStyle mode; private readonly PanelDisplayStyle style;
private readonly Bindable<PanelDisplayStyle> bindable; private readonly Bindable<PanelDisplayStyle> bindable;
public DisplayModeToggleButton(FontAwesome icon, PanelDisplayStyle mode, Bindable<PanelDisplayStyle> bindable) public DisplayStyleToggleButton(FontAwesome icon, PanelDisplayStyle style, Bindable<PanelDisplayStyle> bindable)
{ {
this.bindable = bindable; this.bindable = bindable;
this.mode = mode; this.style = style;
Size = new Vector2(25f); Size = new Vector2(25f);
Children = new Drawable[] Children = new Drawable[]
@ -270,12 +272,12 @@ namespace osu.Game.Overlays.Direct
bindable.ValueChanged += Bindable_ValueChanged; bindable.ValueChanged += Bindable_ValueChanged;
Bindable_ValueChanged(bindable.Value); Bindable_ValueChanged(bindable.Value);
Action = () => bindable.Value = this.mode; Action = () => bindable.Value = this.style;
} }
private void Bindable_ValueChanged(PanelDisplayStyle mode) private void Bindable_ValueChanged(PanelDisplayStyle style)
{ {
icon.FadeTo(mode == this.mode ? 1.0f : 0.5f, 100); icon.FadeTo(style == this.style ? 1.0f : 0.5f, 100);
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)