mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 04:52:57 +08:00
Merge branch 'master' into fix-score-deletion
This commit is contained in:
commit
516186c945
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||
@ -18,38 +19,49 @@ namespace osu.Game.Tests.Visual.Editor
|
||||
{
|
||||
public class TestCaseZoomableScrollContainer : ManualInputManagerTestCase
|
||||
{
|
||||
private readonly ZoomableScrollContainer scrollContainer;
|
||||
private readonly Drawable innerBox;
|
||||
private ZoomableScrollContainer scrollContainer;
|
||||
private Drawable innerBox;
|
||||
|
||||
public TestCaseZoomableScrollContainer()
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
AddStep("Add new scroll container", () =>
|
||||
{
|
||||
new Container
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 250,
|
||||
Width = 0.75f,
|
||||
Children = new Drawable[]
|
||||
new Container
|
||||
{
|
||||
new Box
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 250,
|
||||
Width = 0.75f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(30)
|
||||
},
|
||||
scrollContainer = new ZoomableScrollContainer { RelativeSizeAxes = Axes.Both }
|
||||
}
|
||||
},
|
||||
new MenuCursor()
|
||||
};
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(30)
|
||||
},
|
||||
scrollContainer = new ZoomableScrollContainer { RelativeSizeAxes = Axes.Both }
|
||||
}
|
||||
},
|
||||
new MenuCursor()
|
||||
};
|
||||
|
||||
scrollContainer.Add(innerBox = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientHorizontal(new Color4(0.8f, 0.6f, 0.4f, 1f), new Color4(0.4f, 0.6f, 0.8f, 1f))
|
||||
scrollContainer.Add(innerBox = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientHorizontal(new Color4(0.8f, 0.6f, 0.4f, 1f), new Color4(0.4f, 0.6f, 0.8f, 1f))
|
||||
});
|
||||
});
|
||||
AddUntilStep("Scroll container is loaded", () => scrollContainer.LoadState >= LoadState.Loaded);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestWidthInitialization()
|
||||
{
|
||||
AddAssert("Inner container width was initialized", () => innerBox.DrawWidth > 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -157,6 +157,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
private void confirmPaused()
|
||||
{
|
||||
confirmClockRunning(false);
|
||||
AddAssert("player not exited", () => Player.IsCurrentScreen());
|
||||
AddAssert("player not failed", () => !Player.HasFailed);
|
||||
AddAssert("pause overlay shown", () => Player.PauseOverlayVisible);
|
||||
}
|
||||
|
||||
|
@ -77,13 +77,13 @@ namespace osu.Game.Online.API
|
||||
/// <param name="component"></param>
|
||||
public void Register(IOnlineComponent component)
|
||||
{
|
||||
Scheduler.Add(delegate { components.Add(component); });
|
||||
Schedule(() => components.Add(component));
|
||||
component.APIStateChanged(this, state);
|
||||
}
|
||||
|
||||
public void Unregister(IOnlineComponent component)
|
||||
{
|
||||
Scheduler.Add(delegate { components.Remove(component); });
|
||||
Schedule(() => components.Remove(component));
|
||||
}
|
||||
|
||||
public string AccessToken => authentication.RequestAccessToken();
|
||||
@ -274,7 +274,7 @@ namespace osu.Game.Online.API
|
||||
state = value;
|
||||
|
||||
log.Add($@"We just went {state}!");
|
||||
Scheduler.Add(delegate
|
||||
Schedule(() =>
|
||||
{
|
||||
components.ForEach(c => c.APIStateChanged(this, state));
|
||||
OnStateChange?.Invoke(oldState, state);
|
||||
@ -352,9 +352,13 @@ namespace osu.Game.Online.API
|
||||
public void Logout()
|
||||
{
|
||||
flushQueue();
|
||||
|
||||
password = null;
|
||||
authentication.Clear();
|
||||
LocalUser.Value = createGuestUser();
|
||||
|
||||
// Scheduled prior to state change such that the state changed event is invoked with the correct user present
|
||||
Schedule(() => LocalUser.Value = createGuestUser());
|
||||
|
||||
State = APIState.Offline;
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// This width only gets updated on the application of a transform, so this needs to be initialized here.
|
||||
updateZoomedContentWidth();
|
||||
}
|
||||
|
||||
protected override bool OnScroll(ScrollEvent e)
|
||||
{
|
||||
if (e.IsPrecise)
|
||||
@ -102,6 +110,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateZoomedContentWidth() => zoomedContent.Width = DrawWidth * currentZoom;
|
||||
|
||||
private float zoomTarget = 1;
|
||||
|
||||
private void setZoomTarget(float newZoom, float focusPoint)
|
||||
@ -163,7 +173,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
d.currentZoom = newZoom;
|
||||
|
||||
d.zoomedContent.Width = d.DrawWidth * d.currentZoom;
|
||||
d.updateZoomedContentWidth();
|
||||
// Temporarily here to make sure ScrollTo gets the correct DrawSize for scrollable area.
|
||||
// TODO: Make sure draw size gets invalidated properly on the framework side, and remove this once it is.
|
||||
d.Invalidate(Invalidation.DrawSize);
|
||||
|
Loading…
Reference in New Issue
Block a user