Merge pull request #982 from Tom94/better-input

Replace Contains overrides with ReceiveMouseInputAt
This commit is contained in:
Dean Herbert 2017-07-05 14:08:46 -07:00 committed by GitHub
commit 7162de09f9
17 changed files with 15 additions and 20 deletions

@ -1 +1 @@
Subproject commit 76656c51f281e7934159e9ed4414378fef24d130
Subproject commit 900f47563f5598eef7cbf203f0b3f2166508b6d5

View File

@ -118,7 +118,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
base.Update();
if (Time.Current < slider.EndTime)
Tracking = canCurrentlyTrack && lastState != null && Contains(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed;
Tracking = canCurrentlyTrack && lastState != null && ReceiveMouseInputAt(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed;
}
public void UpdateProgress(double progress, int repeat)

View File

@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
};
}
public override bool Contains(Vector2 screenSpacePos) => true;
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
private bool tracking;
public bool Tracking

View File

@ -74,7 +74,7 @@ namespace osu.Game.Graphics.Cursor
}
}
public override bool Contains(Vector2 screenSpacePos) => true;
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
[BackgroundDependencyLoader]
private void load(ShaderManager shaders, TextureStore textures)

View File

@ -38,7 +38,7 @@ namespace osu.Game.Graphics.UserInterface
public readonly TextAwesome Chevron;
//don't allow clicking between transitions and don't make the chevron clickable
public override bool Contains(Vector2 screenSpacePos) => Alpha == 1f && Text.Contains(screenSpacePos);
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceiveMouseInputAt(screenSpacePos);
public override bool HandleInput => State == Visibility.Visible;
private Visibility state;

View File

@ -91,7 +91,7 @@ namespace osu.Game.Graphics.UserInterface
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);
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceiveMouseInputAt(screenSpacePos);
protected override bool OnClick(Framework.Input.InputState state)
{

View File

@ -23,8 +23,6 @@ namespace osu.Game.Graphics.UserInterface
protected override TabItem<T> CreateTabItem(T value) => new OsuTabItem(value);
public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || Dropdown.Contains(screenSpacePos);
private bool isEnumType => typeof(T).IsEnum;
public OsuTabControl()

View File

@ -169,7 +169,7 @@ namespace osu.Game.Graphics.UserInterface
}
}
public override bool Contains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos);
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => IconLayer.ReceiveMouseInputAt(screenSpacePos) || TextLayer.ReceiveMouseInputAt(screenSpacePos);
protected override bool OnHover(InputState state)
{

View File

@ -60,7 +60,7 @@ namespace osu.Game.Overlays
private readonly Container channelSelectionContainer;
private readonly ChannelSelectionOverlay channelSelection;
public override bool Contains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos);
public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceiveMouseInputAt(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.ReceiveMouseInputAt(screenSpacePos);
public ChatOverlay()
{

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
@ -29,8 +28,6 @@ namespace osu.Game.Overlays.SearchableList
protected abstract T DefaultTab { get; }
protected virtual Drawable CreateSupplementaryControls() => null;
public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || DisplayStyleControl.Dropdown.Contains(screenSpacePos);
protected SearchableListFilterControl()
{
if (!typeof(T).IsEnum)

View File

@ -36,7 +36,7 @@ namespace osu.Game.Screens.Menu
private SampleChannel sampleClick;
private SampleChannel sampleHover;
public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos);
public Button(string text, string sampleName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
{

View File

@ -57,7 +57,7 @@ namespace osu.Game.Screens.Menu
set { colourAndTriangles.Alpha = value ? 1 : 0; }
}
public override bool Contains(Vector2 screenSpacePos) => logoContainer.Contains(screenSpacePos);
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => logoContainer.ReceiveMouseInputAt(screenSpacePos);
public bool Ripple
{

View File

@ -127,7 +127,7 @@ namespace osu.Game.Screens.Play
this.target = target;
}
public override bool Contains(Vector2 screenSpacePos) => true;
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
public override bool HandleInput => true;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play
Button = button;
}
public override bool Contains(Vector2 screenSpacePos) => true;
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
private static string getStringRepresentation(MouseButton button)
{

View File

@ -67,7 +67,7 @@ namespace osu.Game.Screens.Select
private readonly SearchTextBox searchTextBox;
public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos);
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || groupTabs.ReceiveMouseInputAt(screenSpacePos) || sortTabs.ReceiveMouseInputAt(screenSpacePos);
public FilterControl()
{

View File

@ -124,7 +124,7 @@ namespace osu.Game.Screens.Select
updateModeLight();
}
public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || StartButton.Contains(screenSpacePos);
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || StartButton.ReceiveMouseInputAt(screenSpacePos);
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;

View File

@ -84,7 +84,7 @@ namespace osu.Game.Screens.Select.Options
return false;
}
public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos);
public BeatmapOptionsButton()
{