From 58fc0a2622b52277fc333cecef99ac4fe2b0b19c Mon Sep 17 00:00:00 2001 From: Kelvin <2yangk23@gmail.com> Date: Wed, 15 Mar 2017 22:49:23 -0700 Subject: [PATCH 01/14] Make TabControl test label more clear --- .../Tests/TestCaseTabControl.cs | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index a072087956..d09a2d5281 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -1,14 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Diagnostics; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; +using OpenTK; using osu.Framework.Graphics.Primitives; using osu.Framework.Screens.Testing; using osu.Game.Graphics.Sprites; -using osu.Game.Screens.Select.Filter; using osu.Game.Graphics.UserInterface; +using osu.Game.Screens.Select.Filter; namespace osu.Desktop.VisualTests.Tests { @@ -22,24 +20,16 @@ public override void Reset() OsuSpriteText text; OsuTabControl filter; - - Add(new FillFlowContainer + Add(filter = new OsuTabControl { - Direction = FillDirection.Horizontal, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - filter = new OsuTabControl - { - Width = 229, - AutoSort = true - }, - text = new OsuSpriteText - { - Text = "None", - Margin = new MarginPadding(4) - } - } + Width = 229, + AutoSort = true + }); + Add(text = new OsuSpriteText + { + Text = "None", + Margin = new MarginPadding(4), + Position = new Vector2(275, 5) }); filter.PinTab(GroupMode.All); @@ -47,8 +37,7 @@ public override void Reset() filter.ValueChanged += (sender, mode) => { - Debug.WriteLine($"Selected {mode}"); - text.Text = mode.ToString(); + text.Text = "Currently Selected: " + mode.ToString(); }; } } From bd5493fb25f05c85cd5a4c3842be27c05551c715 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 16:43:42 +0900 Subject: [PATCH 02/14] Add back correct defaults. --- osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index d09a2d5281..ba52a6ce6a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -22,7 +22,7 @@ public override void Reset() OsuTabControl filter; Add(filter = new OsuTabControl { - Width = 229, + Size = new Vector2(229, 24), AutoSort = true }); Add(text = new OsuSpriteText diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 167c12b69e..6cddd7b6d8 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; -using osu.Game.Graphics.Sprites; using osu.Game.Screens.Select.Filter; using Container = osu.Framework.Graphics.Containers.Container; using osu.Framework.Graphics.UserInterface.Tab; @@ -97,7 +96,6 @@ public FilterControl() { RelativeSizeAxes = Axes.X, Height = 1, - Y = 24, Colour = OsuColour.Gray(80), Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, @@ -115,6 +113,7 @@ public FilterControl() groupTabs = new OsuTabControl { RelativeSizeAxes = Axes.X, + Height = 24, Width = 0.5f, AutoSort = true }, @@ -133,6 +132,7 @@ public FilterControl() { RelativeSizeAxes = Axes.X, Width = 0.5f, + Height = 24, AutoSort = true, } } From 1156e76c285b3713667e89dedfd235cbf9a7044d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 17:00:49 +0900 Subject: [PATCH 03/14] Don't directly access Header. --- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 2fa2db9a99..067573ace4 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -50,7 +50,7 @@ protected override void Update() { base.Update(); - DropDown.Header.Height = DrawHeight; + DropDown.HeaderHeight = DrawHeight; } } } From 1a7c2eda5ec83f0c9ce49b49d595141790d67ba4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 17:01:02 +0900 Subject: [PATCH 04/14] Size FilterControl relatively now that we can. --- osu.Game/Screens/Select/FilterControl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 6cddd7b6d8..45b6b56bbb 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -76,8 +76,8 @@ public FilterControl() { Padding = new MarginPadding(20), BypassContainsCheck = true, - RelativeSizeAxes = Axes.Y, - Width = 500, + RelativeSizeAxes = Axes.Both, + Width = 0.5f, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Children = new Drawable[] From 93c0fe514080b8266a4a1fa092ef57b913b39993 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 17:02:37 +0900 Subject: [PATCH 05/14] Remove unnecessary set. --- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 067573ace4..4c2ec902a9 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -45,12 +45,5 @@ public Color4 AccentColour item.AccentColour = value; } } - - protected override void Update() - { - base.Update(); - - DropDown.HeaderHeight = DrawHeight; - } } } From e17f7282826a10f79c6590cf5245cdfce2ea21a6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 17:04:03 +0900 Subject: [PATCH 06/14] Fix CI. --- osu.Game/Screens/Select/FilterControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 45b6b56bbb..7dd5c397fb 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -26,7 +26,7 @@ public class FilterControl : Container private OsuTabControl sortTabs; - TabControl groupTabs; + private TabControl groupTabs; private SortMode sort = SortMode.Title; public SortMode Sort From ab8a5afdb91034aa3c2c1e7435be2a6498124666 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 17:38:36 +0900 Subject: [PATCH 07/14] AlwaysReceiveInput and InternalContains. --- .../Objects/Drawables/DrawableSlider.cs | 8 ++++---- .../Objects/Drawables/DrawableSpinner.cs | 4 ++-- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 4 ++-- osu.Game/Graphics/Containers/ParallaxContainer.cs | 4 ++-- osu.Game/Graphics/Cursor/CursorTrail.cs | 2 +- osu.Game/Graphics/Processing/RatioAdjust.cs | 3 +-- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 2 +- osu.Game/Modes/UI/Playfield.cs | 13 ++++++++++--- osu.Game/Overlays/Toolbar/Toolbar.cs | 13 ++++--------- osu.Game/Overlays/Toolbar/ToolbarUserArea.cs | 4 ++-- osu.Game/Screens/Menu/Button.cs | 5 +---- osu.Game/Screens/Menu/OsuLogo.cs | 5 +---- osu.Game/Screens/Play/KeyCounterCollection.cs | 7 +++---- osu.Game/Screens/Play/KeyCounterMouse.cs | 3 +-- osu.Game/Screens/Play/PauseOverlay.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 6 +++--- osu.Game/Screens/Select/Footer.cs | 4 ++-- .../Screens/Select/Options/BeatmapOptionsButton.cs | 2 +- 19 files changed, 43 insertions(+), 50 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index 036f12167a..5df2e26bc3 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -28,6 +28,10 @@ public class DrawableSlider : DrawableOsuHitObject, IDrawableHitObjectWithProxie public DrawableSlider(Slider s) : base(s) { + // Since the DrawableSlider itself is just a container without a size we need to + // pass all input through. + AlwaysReceiveInput = true; + SliderBouncer bouncer1; slider = s; @@ -91,10 +95,6 @@ public DrawableSlider(Slider s) : base(s) } } - // Since the DrawableSlider itself is just a container without a size we need to - // pass all input through. - public override bool Contains(Vector2 screenSpacePos) => true; - private int currentRepeat; protected override void Update() diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs index be3048a9ba..97df378f86 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -24,6 +24,8 @@ public class DrawableSpinner : DrawableOsuHitObject public DrawableSpinner(Spinner s) : base(s) { + AlwaysReceiveInput = true; + Origin = Anchor.Centre; Position = s.Position; @@ -69,8 +71,6 @@ public DrawableSpinner(Spinner s) : base(s) disc.Scale = scaleToCircle; } - public override bool Contains(Vector2 screenSpacePos) => true; - protected override void CheckJudgement(bool userTriggered) { if (Time.Current < HitObject.StartTime) return; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 34dec34cb4..906a3cd7c3 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -19,8 +19,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { public class SpinnerDisc : CircularContainer { - public override bool Contains(Vector2 screenSpacePos) => true; - protected Sprite Disc; public SRGBColour DiscColour @@ -101,6 +99,8 @@ protected override void Update() public SpinnerDisc() { + AlwaysReceiveInput = true; + RelativeSizeAxes = Axes.Both; Children = new Drawable[] diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 88627dbd30..c4cd1777e1 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -18,10 +18,10 @@ internal class ParallaxContainer : Container private Bindable parallaxEnabled; - public override bool Contains(Vector2 screenSpacePos) => true; - public ParallaxContainer() { + AlwaysReceiveInput = true; + RelativeSizeAxes = Axes.Both; AddInternal(content = new Container { diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index 09d1193661..ffd96d9622 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -18,7 +18,6 @@ namespace osu.Game.Graphics.Cursor { internal class CursorTrail : Drawable { - public override bool Contains(Vector2 screenSpacePos) => true; public override bool HandleInput => true; private int currentIndex; @@ -59,6 +58,7 @@ protected override void ApplyDrawNode(DrawNode node) public CursorTrail() { + AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; for (int i = 0; i < max_sprites; i++) diff --git a/osu.Game/Graphics/Processing/RatioAdjust.cs b/osu.Game/Graphics/Processing/RatioAdjust.cs index 219d75c675..dd039d5144 100644 --- a/osu.Game/Graphics/Processing/RatioAdjust.cs +++ b/osu.Game/Graphics/Processing/RatioAdjust.cs @@ -10,10 +10,9 @@ namespace osu.Game.Graphics.Processing { internal class RatioAdjust : Container { - public override bool Contains(Vector2 screenSpacePos) => true; - public RatioAdjust() { + AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 590c5bf393..49b5f1e509 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -88,7 +88,7 @@ internal float TextSize private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking - public override bool Contains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos); + protected override bool InternalContains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos); protected override bool OnClick(Framework.Input.InputState state) { diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 8221ef952f..0d4e72f92c 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -158,7 +158,7 @@ public string Text } } - public override bool Contains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos); + protected override bool InternalContains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos); protected override bool OnHover(InputState state) { diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index 288b4bf352..bff461f649 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -18,7 +18,6 @@ public abstract class Playfield : Container /// The HitObjects contained in this Playfield. /// public HitObjectContainer> HitObjects; - public override bool Contains(Vector2 screenSpacePos) => true; internal Container ScaledContent; @@ -31,6 +30,8 @@ public abstract class Playfield : Container /// Whether we want our internal coordinate system to be scaled to a specified width. protected Playfield(float? customWidth = null) { + AlwaysReceiveInput = true; + AddInternal(ScaledContent = new ScaledContainer { CustomWidth = customWidth, @@ -77,12 +78,18 @@ private class ScaledContainer : Container //dividing by the customwidth will effectively scale our content to the required container size. protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale; - public override bool Contains(Vector2 screenSpacePos) => true; + public ScaledContainer() + { + AlwaysReceiveInput = true; + } } public class HitObjectContainer : Container where U : Drawable { - public override bool Contains(Vector2 screenSpacePos) => true; + public HitObjectContainer() + { + AlwaysReceiveInput = true; + } } } } diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 79698a4f3e..657334d1bb 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -35,10 +35,10 @@ public class Toolbar : OverlayContainer private const float alpha_hovering = 0.8f; private const float alpha_normal = 0.6f; - public override bool Contains(Vector2 screenSpacePos) => true; - public Toolbar() { + AlwaysReceiveInput = true; + Children = new Drawable[] { new ToolbarBackground(), @@ -63,8 +63,9 @@ public Toolbar() } } }, - new PassThroughFlowContainer + new FillFlowContainer { + AlwaysReceiveInput = true, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Direction = FillDirection.Horizontal, @@ -144,11 +145,5 @@ protected override void PopOut() MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint); FadeOut(transition_time); } - - private class PassThroughFlowContainer : FillFlowContainer - { - //needed to get input to the login overlay. - public override bool Contains(Vector2 screenSpacePos) => true; - } } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs index 9de0f290a5..7f28764b17 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs @@ -15,10 +15,10 @@ internal class ToolbarUserArea : Container public override RectangleF BoundingBox => button.BoundingBox; - public override bool Contains(Vector2 screenSpacePos) => true; - public ToolbarUserArea() { + AlwaysReceiveInput = true; + RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 7af03d2f11..52872c858b 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -35,10 +35,7 @@ public class Button : Container, IStateful private Key triggerKey; private SampleChannel sampleClick; - public override bool Contains(Vector2 screenSpacePos) - { - return box.Contains(screenSpacePos); - } + protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown) { diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 01622fe096..259e98c483 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -50,10 +50,7 @@ public bool Triangles } } - public override bool Contains(Vector2 screenSpacePos) - { - return logoContainer.Contains(screenSpacePos); - } + protected override bool InternalContains(Vector2 screenSpacePos) => logoContainer.Contains(screenSpacePos); public bool Ripple { diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index aa2bf47227..bbda7ae318 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -14,6 +14,8 @@ public class KeyCounterCollection : FillFlowContainer { public KeyCounterCollection() { + AlwaysReceiveInput = true; + Direction = FillDirection.Horizontal; AutoSizeAxes = Axes.Both; } @@ -33,8 +35,6 @@ public void ResetCount() counter.ResetCount(); } - public override bool Contains(Vector2 screenSpacePos) => true; - //further: change default values here and in KeyCounter if needed, instead of passing them in every constructor private bool isCounting; public bool IsCounting @@ -111,12 +111,11 @@ public class Receptor : Drawable public Receptor(KeyCounterCollection target) { + AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; this.target = target; } - public override bool Contains(Vector2 screenSpacePos) => true; - public override bool HandleInput => true; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerKeyDown(state, args)); diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 425bcffee5..b0b93e80e7 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -13,6 +13,7 @@ public class KeyCounterMouse : KeyCounter public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button)) { + AlwaysReceiveInput = true; Button = button; } @@ -29,8 +30,6 @@ private static string getStringRepresentation(MouseButton button) } } - public override bool Contains(Vector2 screenSpacePos) => true; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (args.Button == Button) IsLit = true; diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 0f3303fc29..b862adcd53 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -70,7 +70,6 @@ public int Retries private FillFlowContainer retryCounterContainer; - public override bool Contains(Vector2 screenSpacePos) => true; public override bool HandleInput => State == Visibility.Visible; protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In); @@ -217,6 +216,7 @@ private void resume() public PauseOverlay() { + AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; } } diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 7dd5c397fb..a655d0c4d4 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -60,7 +60,7 @@ public GroupMode Group private SearchTextBox searchTextBox; - public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos); + protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos); public FilterControl() { @@ -75,7 +75,7 @@ public FilterControl() new Container { Padding = new MarginPadding(20), - BypassContainsCheck = true, + AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, Width = 0.5f, Anchor = Anchor.TopRight, @@ -107,7 +107,7 @@ public FilterControl() Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - BypassContainsCheck = true, + AlwaysReceiveInput = true, Children = new Drawable[] { groupTabs = new OsuTabControl diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index fae1cb5d4d..0e369c78b9 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -26,8 +26,6 @@ public class Footer : Container private const float padding = 80; - public override bool Contains(Vector2 screenSpacePos) => true; - public Action OnBack; public Action OnStart; @@ -69,6 +67,8 @@ private void updateModeLight(FooterButton button = null) public Footer() { + AlwaysReceiveInput = true; + const float bottom_tool_height = 50; RelativeSizeAxes = Axes.X; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index cfe8eea07f..a0bc702aac 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -83,7 +83,7 @@ protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) return false; } - public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); + protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); public BeatmapOptionsButton() { From 3b77fcd5d5fc0e624a77fd9f887f16487c7e45f5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 19:15:18 +0900 Subject: [PATCH 08/14] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 67dd51e27c..4e64545c34 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 67dd51e27c1a4cbbc17f29fee5dee3a125eed78e +Subproject commit 4e64545c34b71ddf6be1ce2c85d0bbb9ff15ef6c From 64825c32c554f50526b620d151bf53ebd18d48be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 21:16:30 +0900 Subject: [PATCH 09/14] Add margin to testcase to better see edges. --- osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index ba52a6ce6a..19cc32078c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -22,6 +22,7 @@ public override void Reset() OsuTabControl filter; Add(filter = new OsuTabControl { + Margin = new MarginPadding(4), Size = new Vector2(229, 24), AutoSort = true }); From 110bdbd0c11069fa42a1744272b8e3cbc47a7444 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 21:17:14 +0900 Subject: [PATCH 10/14] Make everything share DropDown implementations again. Remove unnecessary files. --- .../UserInterface/OsuDropDownHeader.cs | 15 +- .../Graphics/UserInterface/OsuDropDownMenu.cs | 46 +++++-- .../UserInterface/OsuDropDownMenuItem.cs | 38 ++++- .../Graphics/UserInterface/OsuTabControl.cs | 93 ++++++++++++- .../UserInterface/OsuTabDropDownMenu.cs | 130 ------------------ .../UserInterface/OsuTabDropDownMenuItem.cs | 54 -------- osu.Game/Graphics/UserInterface/OsuTabItem.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 1 - osu.Game/Screens/Play/KeyCounterMouse.cs | 1 - osu.Game/Screens/Select/FilterControl.cs | 2 +- osu.Game/osu.Game.csproj | 2 - 11 files changed, 173 insertions(+), 211 deletions(-) delete mode 100644 osu.Game/Graphics/UserInterface/OsuTabDropDownMenu.cs delete mode 100644 osu.Game/Graphics/UserInterface/OsuTabDropDownMenuItem.cs diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs b/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs index 176c066af5..00dc510338 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownHeader.cs @@ -21,6 +21,17 @@ protected override string Label set { label.Text = value; } } + private Color4? accentColour; + public virtual Color4 AccentColour + { + get { return accentColour.GetValueOrDefault(); } + set + { + accentColour = value; + BackgroundColourHover = value; + } + } + public OsuDropDownHeader() { Foreground.Padding = new MarginPadding(4); @@ -30,7 +41,7 @@ public OsuDropDownHeader() CornerRadius = 4; Height = 40; - Children = new[] + Foreground.Children = new Drawable[] { label = new OsuSpriteText { @@ -51,7 +62,7 @@ public OsuDropDownHeader() private void load(OsuColour colours) { BackgroundColour = Color4.Black.Opacity(0.5f); - BackgroundColourHover = colours.PinkDarker; + BackgroundColourHover = accentColour ?? colours.PinkDarker; } } } \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs b/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs index 14615417f7..5d9e30db8d 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs @@ -1,39 +1,61 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; +using osu.Framework.Allocation; using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface { - public class OsuDropDownMenu : DropDownMenu + public class OsuDropDownMenu : DropDownMenu { - protected override DropDownHeader CreateHeader() => new OsuDropDownHeader(); + protected override DropDownHeader CreateHeader() => new OsuDropDownHeader { AccentColour = AccentColour }; + + private Color4? accentColour; + public virtual Color4 AccentColour + { + get { return accentColour.GetValueOrDefault(); } + set + { + accentColour = value; + if (Header != null) + ((OsuDropDownHeader)Header).AccentColour = value; + foreach (var item in ItemList.OfType>()) + item.AccentColour = value; + } + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + if (accentColour == null) + AccentColour = colours.PinkDarker; + } public OsuDropDownMenu() { ContentContainer.CornerRadius = 4; ContentBackground.Colour = Color4.Black.Opacity(0.5f); + + DropDownItemsContainer.Padding = new MarginPadding(5); } - protected override void AnimateOpen() - { - ContentContainer.FadeIn(300, EasingTypes.OutQuint); - } + protected override void AnimateOpen() => ContentContainer.FadeIn(300, EasingTypes.OutQuint); - protected override void AnimateClose() - { - ContentContainer.FadeOut(300, EasingTypes.OutQuint); - } + protected override void AnimateClose() => ContentContainer.FadeOut(300, EasingTypes.OutQuint); protected override void UpdateContentHeight() { - ContentContainer.ResizeTo(State == DropDownMenuState.Opened ? new Vector2(1, ContentHeight) : new Vector2(1, 0), 300, EasingTypes.OutQuint); + var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight; + ContentContainer.ResizeTo(new Vector2(1, State == DropDownMenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); } - protected override DropDownMenuItem CreateDropDownItem(string key, U value) => new OsuDropDownMenuItem(key, value); + protected override DropDownMenuItem CreateDropDownItem(string key, T value) => new OsuDropDownMenuItem(key, value) { AccentColour = AccentColour }; } } \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs index b06422c302..71650dee52 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDownMenuItem.cs @@ -18,6 +18,9 @@ public OsuDropDownMenuItem(string text, U value) : base(text, value) { Foreground.Padding = new MarginPadding(2); + Masking = true; + CornerRadius = 6; + Children = new[] { new FillFlowContainer @@ -27,12 +30,15 @@ public OsuDropDownMenuItem(string text, U value) : base(text, value) AutoSizeAxes = Axes.Y, Children = new Drawable[] { - new TextAwesome + chevron = new TextAwesome { + AlwaysPresent = true, Icon = FontAwesome.fa_chevron_right, + UseFullGlyphHeight = false, Colour = Color4.Black, - TextSize = 12, - Margin = new MarginPadding { Right = 3 }, + Alpha = 0.5f, + TextSize = 8, + Margin = new MarginPadding { Left = 3, Right = 3 }, Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, }, @@ -46,11 +52,33 @@ public OsuDropDownMenuItem(string text, U value) : base(text, value) }; } + private Color4? accentColour; + + private TextAwesome chevron; + + protected override void FormatForeground(bool hover = false) + { + base.FormatForeground(hover); + chevron.Alpha = hover ? 1 : 0; + } + + public Color4 AccentColour + { + get { return accentColour.GetValueOrDefault(); } + set + { + accentColour = value; + BackgroundColourHover = BackgroundColourSelected = value; + FormatBackground(); + FormatForeground(); + } + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { - BackgroundColour = Color4.Black.Opacity(0.5f); - BackgroundColourHover = colours.PinkDarker; + BackgroundColour = Color4.Transparent; + BackgroundColourHover = accentColour ?? colours.PinkDarker; BackgroundColourSelected = Color4.Black.Opacity(0.5f); } } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 4c2ec902a9..05f154a407 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -5,18 +5,24 @@ using System.Linq; using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Graphics.UserInterface.Tab; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; namespace osu.Game.Graphics.UserInterface { public class OsuTabControl : TabControl { - protected override TabDropDownMenu CreateDropDownMenu() => new OsuTabDropDownMenu(); + protected override DropDownMenu CreateDropDownMenu() => new OsuTabDropDownMenu(); protected override TabItem CreateTabItem(T value) => new OsuTabItem { Value = value }; public OsuTabControl() { + AlwaysReceiveInput = true; + if (!typeof(T).IsEnum) throw new InvalidOperationException("OsuTabControl only supports enums as the generic type argument"); @@ -45,5 +51,88 @@ public Color4 AccentColour item.AccentColour = value; } } + + public class OsuTabDropDownMenu : OsuDropDownMenu + { + protected override DropDownHeader CreateHeader() => new OsuTabDropDownHeader + { + AccentColour = AccentColour, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }; + + protected override DropDownMenuItem CreateDropDownItem(string key, T1 value) + { + var item = base.CreateDropDownItem(key, value); + item.ForegroundColourHover = Color4.Black; + return item; + } + + public OsuTabDropDownMenu() + { + ContentContainer.Anchor = Anchor.TopRight; + ContentContainer.Origin = Anchor.TopRight; + + RelativeSizeAxes = Axes.X; + + ContentBackground.Colour = Color4.Black.Opacity(0.7f); + MaxDropDownHeight = 400; + } + + public class OsuTabDropDownHeader : OsuDropDownHeader + { + public override Color4 AccentColour + { + get { return base.AccentColour; } + set + { + base.AccentColour = value; + Foreground.Colour = value; + } + } + + protected override bool OnHover(InputState state) + { + Foreground.Colour = BackgroundColour; + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + Foreground.Colour = BackgroundColourHover; + base.OnHoverLost(state); + } + + public OsuTabDropDownHeader() + { + RelativeSizeAxes = Axes.None; + AutoSizeAxes = Axes.X; + + BackgroundColour = Color4.Black.Opacity(0.5f); + + Background.Height = 0.5f; + Background.CornerRadius = 5; + Background.Masking = true; + + Foreground.RelativeSizeAxes = Axes.None; + Foreground.AutoSizeAxes = Axes.X; + Foreground.RelativeSizeAxes = Axes.Y; + Foreground.Margin = new MarginPadding(5); + + Foreground.Children = new Drawable[] + { + new TextAwesome + { + Icon = FontAwesome.fa_ellipsis_h, + TextSize = 14, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + } + }; + + Padding = new MarginPadding { Left = 5, Right = 5 }; + } + } + } } } diff --git a/osu.Game/Graphics/UserInterface/OsuTabDropDownMenu.cs b/osu.Game/Graphics/UserInterface/OsuTabDropDownMenu.cs deleted file mode 100644 index 1b64056d97..0000000000 --- a/osu.Game/Graphics/UserInterface/OsuTabDropDownMenu.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Linq; -using OpenTK; -using OpenTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Transforms; -using osu.Framework.Graphics.UserInterface; -using osu.Framework.Graphics.UserInterface.Tab; -using osu.Framework.Input; - -namespace osu.Game.Graphics.UserInterface -{ - public class OsuTabDropDownMenu : TabDropDownMenu - { - private Color4? accentColour; - public Color4 AccentColour - { - get { return accentColour.GetValueOrDefault(); } - set - { - accentColour = value; - ((OsuTabDropDownHeader)Header).AccentColour = value; - foreach (var item in ItemList.OfType>()) - item.AccentColour = value; - } - } - - protected override DropDownHeader CreateHeader() => new OsuTabDropDownHeader - { - AccentColour = AccentColour - }; - - protected override DropDownMenuItem CreateDropDownItem(string key, T value) => - new OsuTabDropDownMenuItem(key, value) { AccentColour = AccentColour }; - - public OsuTabDropDownMenu() - { - MaxDropDownHeight = int.MaxValue; - ContentContainer.CornerRadius = 4; - ContentBackground.Colour = Color4.Black.Opacity(0.9f); - ScrollContainer.ScrollDraggerVisible = false; - DropDownItemsContainer.Padding = new MarginPadding { Left = 5, Bottom = 7, Right = 5, Top = 7 }; - } - - protected override void AnimateOpen() - { - ContentContainer.FadeIn(300, EasingTypes.OutQuint); - } - - protected override void AnimateClose() - { - ContentContainer.FadeOut(300, EasingTypes.OutQuint); - } - - protected override void UpdateContentHeight() - { - ContentContainer.ResizeTo(new Vector2(1, State == DropDownMenuState.Opened ? ContentHeight : 0), 300, EasingTypes.OutQuint); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - if (accentColour == null) - AccentColour = colours.Blue; - } - - public class OsuTabDropDownHeader : DropDownHeader - { - protected override string Label { get; set; } - - private Color4? accentColour; - public Color4 AccentColour - { - get { return accentColour.GetValueOrDefault(); } - set - { - accentColour = value; - BackgroundColourHover = value; - Foreground.Colour = value; - } - } - - protected override bool OnHover(InputState state) - { - Foreground.Colour = BackgroundColour; - return base.OnHover(state); - } - - protected override void OnHoverLost(InputState state) - { - Foreground.Colour = BackgroundColourHover; - base.OnHoverLost(state); - } - - public OsuTabDropDownHeader() - { - RelativeSizeAxes = Axes.None; - AutoSizeAxes = Axes.X; - - BackgroundColour = Color4.Black; - - Background.Height = 0.5f; - Background.CornerRadius = 3; - Background.Masking = true; - - Foreground.RelativeSizeAxes = Axes.None; - Foreground.AutoSizeAxes = Axes.X; - Foreground.RelativeSizeAxes = Axes.Y; - Foreground.Margin = new MarginPadding(5); - Foreground.Children = new Drawable[] - { - new TextAwesome - { - Icon = FontAwesome.fa_ellipsis_h, - TextSize = 14, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - } - }; - - Padding = new MarginPadding { Left = 5, Right = 5 }; - } - } - } -} diff --git a/osu.Game/Graphics/UserInterface/OsuTabDropDownMenuItem.cs b/osu.Game/Graphics/UserInterface/OsuTabDropDownMenuItem.cs deleted file mode 100644 index 86d451f7bb..0000000000 --- a/osu.Game/Graphics/UserInterface/OsuTabDropDownMenuItem.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.UserInterface; -using OpenTK.Graphics; -using osu.Game.Graphics.Sprites; - -namespace osu.Game.Graphics.UserInterface -{ - public class OsuTabDropDownMenuItem : DropDownMenuItem - { - public OsuTabDropDownMenuItem(string text, T value) : base(text, value) - { - Foreground.Padding = new MarginPadding { Top = 4, Bottom = 4 }; - Foreground.Margin = new MarginPadding { Left = 7 }; - - Masking = true; - CornerRadius = 6; - Foreground.Add(new OsuSpriteText - { - Text = text, - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - }); - } - - private Color4? accentColour; - public Color4 AccentColour - { - get { return accentColour.GetValueOrDefault(); } - set - { - accentColour = value; - BackgroundColourHover = BackgroundColourSelected = value; - FormatBackground(); - FormatForeground(); - } - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - BackgroundColour = Color4.Black.Opacity(0f); - ForegroundColourHover = Color4.Black; - ForegroundColourSelected = Color4.Black; - if (accentColour == null) - AccentColour = colours.Blue; - } - } -} diff --git a/osu.Game/Graphics/UserInterface/OsuTabItem.cs b/osu.Game/Graphics/UserInterface/OsuTabItem.cs index 9b8ea58a56..c394ee31a0 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabItem.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface.Tab; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index bbda7ae318..bb6ab34cbb 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -4,7 +4,6 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using OpenTK; using OpenTK.Graphics; using osu.Framework.Input; diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index b0b93e80e7..744cb905d9 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Input; -using OpenTK; using OpenTK.Input; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index a655d0c4d4..637b6eafbc 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -9,11 +9,11 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select.Filter; using Container = osu.Framework.Graphics.Containers.Container; -using osu.Framework.Graphics.UserInterface.Tab; using osu.Framework.Input; namespace osu.Game.Screens.Select diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1936628ad5..a947742582 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -350,8 +350,6 @@ - - From 84b080a060eccb397959af51ecff002e9a983f3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 21:26:03 +0900 Subject: [PATCH 11/14] Make transition logic a bit more sane. --- osu.Game/Graphics/UserInterface/OsuTabItem.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabItem.cs b/osu.Game/Graphics/UserInterface/OsuTabItem.cs index c394ee31a0..c34ea09e2c 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabItem.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Game.Graphics.Sprites; @@ -54,16 +55,18 @@ public override bool Active } } + private const float transition_length = 500; + private void fadeActive() { - box.FadeIn(300); - text.FadeColour(Color4.White, 300); + box.FadeIn(transition_length, EasingTypes.OutQuint); + text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); } private void fadeInactive() { - box.FadeOut(300); - text.FadeColour(AccentColour, 300); + box.FadeOut(transition_length, EasingTypes.OutQuint); + text.FadeColour(AccentColour, transition_length, EasingTypes.OutQuint); } protected override bool OnHover(InputState state) From 2cf6ed423e789fe655e41b8d6d1eb058fb94f474 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 21:33:08 +0900 Subject: [PATCH 12/14] Disallow duplicate active changes. --- osu.Game/Graphics/UserInterface/OsuTabItem.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/OsuTabItem.cs b/osu.Game/Graphics/UserInterface/OsuTabItem.cs index c34ea09e2c..acfca1b67b 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabItem.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabItem.cs @@ -47,6 +47,8 @@ public override bool Active get { return base.Active; } set { + if (Active == value) return; + if (value) fadeActive(); else From 8cd1353d747b824709c1d3b92611cfc9cb2df81e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 22:09:35 +0900 Subject: [PATCH 13/14] Fix serious input regression. --- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 05f154a407..02cd5d683a 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; @@ -19,10 +20,10 @@ public class OsuTabControl : TabControl protected override TabItem CreateTabItem(T value) => new OsuTabItem { Value = value }; + protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || DropDown.Contains(screenSpacePos); + public OsuTabControl() { - AlwaysReceiveInput = true; - if (!typeof(T).IsEnum) throw new InvalidOperationException("OsuTabControl only supports enums as the generic type argument"); From c07cba7f885a6991a872dec829fd7776fc4ae5c7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Mar 2017 22:11:42 +0900 Subject: [PATCH 14/14] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 4e64545c34..53dfe2a110 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4e64545c34b71ddf6be1ce2c85d0bbb9ff15ef6c +Subproject commit 53dfe2a110d732cca0e7df58c33eca368bc7ff61