Add a sample way to have local cursors move beyond their bounds

This commit is contained in:
smoogipoo 2018-01-16 20:35:39 +09:00
parent a5415b99ae
commit 06f0f2093c
1 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
@ -81,10 +82,14 @@ public TestCaseCursors()
};
returnUserInput();
AddToggleStep("Smooth transitions", b => cursorBoxes.ForEach(box => box.SmoothTransition = b));
testUserCursor();
testLocalCursor();
testUserCursorOverride();
testMultipleLocalCursors();
returnUserInput();
}
/// <summary>
@ -196,9 +201,13 @@ private bool checkAtMouse(CursorContainer cursorContainer)
private class CustomCursorBox : Container, IProvideCursor
{
public bool SmoothTransition;
public CursorContainer Cursor { get; }
public bool ProvidingUserCursor { get; }
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || SmoothTransition && !ProvidingUserCursor;
private readonly Box background;
public CustomCursorBox(Color4 cursorColour, bool providesUserCursor = true)