mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:07:38 +08:00
Merge branch 'master' into fix-load-async-after-disposal-beatmap-wedge
This commit is contained in:
commit
29e8e5ab94
@ -62,6 +62,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
|
|
||||||
public abstract class DrawableCatchHitObject : DrawableHitObject<CatchHitObject>
|
public abstract class DrawableCatchHitObject : DrawableHitObject<CatchHitObject>
|
||||||
{
|
{
|
||||||
|
protected override double InitialLifetimeOffset => HitObject.TimePreempt;
|
||||||
|
|
||||||
public virtual bool StaysOnPlate => HitObject.CanBePlated;
|
public virtual bool StaysOnPlate => HitObject.CanBePlated;
|
||||||
|
|
||||||
public float DisplayRadius => DrawSize.X / 2 * Scale.X * HitObject.Scale;
|
public float DisplayRadius => DrawSize.X / 2 * Scale.X * HitObject.Scale;
|
||||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Catch.Replays
|
|||||||
if (Position > lastCatchFrame.Position)
|
if (Position > lastCatchFrame.Position)
|
||||||
lastCatchFrame.Actions.Add(CatchAction.MoveRight);
|
lastCatchFrame.Actions.Add(CatchAction.MoveRight);
|
||||||
else if (Position < lastCatchFrame.Position)
|
else if (Position < lastCatchFrame.Position)
|
||||||
Actions.Add(CatchAction.MoveLeft);
|
lastCatchFrame.Actions.Add(CatchAction.MoveLeft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddToggleStep("toggle y", state => selectionBox.CanScaleY = state);
|
AddToggleStep("toggle y", state => selectionBox.CanScaleY = state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleScale(Vector2 amount, Anchor reference)
|
private bool handleScale(Vector2 amount, Anchor reference)
|
||||||
{
|
{
|
||||||
if ((reference & Anchor.y1) == 0)
|
if ((reference & Anchor.y1) == 0)
|
||||||
{
|
{
|
||||||
@ -58,12 +58,15 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
selectionArea.X += amount.X;
|
selectionArea.X += amount.X;
|
||||||
selectionArea.Width += directionX * amount.X;
|
selectionArea.Width += directionX * amount.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRotation(float angle)
|
private bool handleRotation(float angle)
|
||||||
{
|
{
|
||||||
// kinda silly and wrong, but just showing that the drag handles work.
|
// kinda silly and wrong, but just showing that the drag handles work.
|
||||||
selectionArea.Rotation += angle;
|
selectionArea.Rotation += angle;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,14 @@ using osu.Framework.Graphics.Colour;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Utils;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editing
|
namespace osu.Game.Tests.Visual.Editing
|
||||||
{
|
{
|
||||||
@ -88,6 +89,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
|
|
||||||
// Scroll in at 0.25
|
// Scroll in at 0.25
|
||||||
AddStep("Move mouse to 0.25x", () => InputManager.MoveMouseTo(new Vector2(scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X, scrollQuad.Centre.Y)));
|
AddStep("Move mouse to 0.25x", () => InputManager.MoveMouseTo(new Vector2(scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X, scrollQuad.Centre.Y)));
|
||||||
|
AddStep("Press alt down", () => InputManager.PressKey(Key.AltLeft));
|
||||||
AddStep("Scroll by 3", () => InputManager.ScrollBy(new Vector2(0, 3)));
|
AddStep("Scroll by 3", () => InputManager.ScrollBy(new Vector2(0, 3)));
|
||||||
AddAssert("Box not at 0", () => !Precision.AlmostEquals(boxQuad.TopLeft, scrollQuad.TopLeft));
|
AddAssert("Box not at 0", () => !Precision.AlmostEquals(boxQuad.TopLeft, scrollQuad.TopLeft));
|
||||||
AddAssert("Box 1/4 at 1/4", () => Precision.AlmostEquals(boxQuad.TopLeft.X + 0.25f * boxQuad.Size.X, scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X));
|
AddAssert("Box 1/4 at 1/4", () => Precision.AlmostEquals(boxQuad.TopLeft.X + 0.25f * boxQuad.Size.X, scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X));
|
||||||
@ -96,6 +98,25 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddStep("Scroll by -3", () => InputManager.ScrollBy(new Vector2(0, -3)));
|
AddStep("Scroll by -3", () => InputManager.ScrollBy(new Vector2(0, -3)));
|
||||||
AddAssert("Box at 0", () => Precision.AlmostEquals(boxQuad.TopLeft, scrollQuad.TopLeft));
|
AddAssert("Box at 0", () => Precision.AlmostEquals(boxQuad.TopLeft, scrollQuad.TopLeft));
|
||||||
AddAssert("Box 1/4 at 1/4", () => Precision.AlmostEquals(boxQuad.TopLeft.X + 0.25f * boxQuad.Size.X, scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X));
|
AddAssert("Box 1/4 at 1/4", () => Precision.AlmostEquals(boxQuad.TopLeft.X + 0.25f * boxQuad.Size.X, scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X));
|
||||||
|
AddStep("Release alt", () => InputManager.ReleaseKey(Key.AltLeft));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMouseZoomInThenScroll()
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
|
||||||
|
// Scroll in at 0.25
|
||||||
|
AddStep("Move mouse to 0.25x", () => InputManager.MoveMouseTo(new Vector2(scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X, scrollQuad.Centre.Y)));
|
||||||
|
AddStep("Press alt down", () => InputManager.PressKey(Key.AltLeft));
|
||||||
|
AddStep("Zoom by 3", () => InputManager.ScrollBy(new Vector2(0, 3)));
|
||||||
|
AddStep("Release alt", () => InputManager.ReleaseKey(Key.AltLeft));
|
||||||
|
|
||||||
|
AddStep("Scroll far left", () => InputManager.ScrollBy(new Vector2(0, 30)));
|
||||||
|
AddUntilStep("Scroll is at start", () => Precision.AlmostEquals(scrollQuad.TopLeft.X, boxQuad.TopLeft.X, 1));
|
||||||
|
|
||||||
|
AddStep("Scroll far right", () => InputManager.ScrollBy(new Vector2(0, -300)));
|
||||||
|
AddUntilStep("Scroll is at end", () => Precision.AlmostEquals(scrollQuad.TopRight.X, boxQuad.TopRight.X, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -103,6 +124,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
AddStep("Press alt down", () => InputManager.PressKey(Key.AltLeft));
|
||||||
|
|
||||||
// Scroll in at 0.25
|
// Scroll in at 0.25
|
||||||
AddStep("Move mouse to 0.25x", () => InputManager.MoveMouseTo(new Vector2(scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X, scrollQuad.Centre.Y)));
|
AddStep("Move mouse to 0.25x", () => InputManager.MoveMouseTo(new Vector2(scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X, scrollQuad.Centre.Y)));
|
||||||
AddStep("Scroll by 1", () => InputManager.ScrollBy(new Vector2(0, 1)));
|
AddStep("Scroll by 1", () => InputManager.ScrollBy(new Vector2(0, 1)));
|
||||||
@ -124,6 +147,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddStep("Move mouse to 0.25x", () => InputManager.MoveMouseTo(new Vector2(scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X, scrollQuad.Centre.Y)));
|
AddStep("Move mouse to 0.25x", () => InputManager.MoveMouseTo(new Vector2(scrollQuad.TopLeft.X + 0.25f * scrollQuad.Size.X, scrollQuad.Centre.Y)));
|
||||||
AddStep("Scroll by -1", () => InputManager.ScrollBy(new Vector2(0, -1)));
|
AddStep("Scroll by -1", () => InputManager.ScrollBy(new Vector2(0, -1)));
|
||||||
AddAssert("Box at 0", () => Precision.AlmostEquals(boxQuad.TopLeft, scrollQuad.TopLeft));
|
AddAssert("Box at 0", () => Precision.AlmostEquals(boxQuad.TopLeft, scrollQuad.TopLeft));
|
||||||
|
|
||||||
|
AddStep("Release alt", () => InputManager.ReleaseKey(Key.AltLeft));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reset()
|
private void reset()
|
||||||
|
@ -132,6 +132,8 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
Set(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin);
|
Set(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin);
|
||||||
Set(OsuSetting.SeasonalBackgroundMode, SeasonalBackgroundMode.Sometimes);
|
Set(OsuSetting.SeasonalBackgroundMode, SeasonalBackgroundMode.Sometimes);
|
||||||
|
|
||||||
|
Set(OsuSetting.EditorWaveformOpacity, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsuConfigManager(Storage storage)
|
public OsuConfigManager(Storage storage)
|
||||||
@ -241,6 +243,7 @@ namespace osu.Game.Configuration
|
|||||||
HitLighting,
|
HitLighting,
|
||||||
MenuBackgroundSource,
|
MenuBackgroundSource,
|
||||||
GameplayDisableWinKey,
|
GameplayDisableWinKey,
|
||||||
SeasonalBackgroundMode
|
SeasonalBackgroundMode,
|
||||||
|
EditorWaveformOpacity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,30 +163,27 @@ namespace osu.Game.Screens.Edit.Components.Menus
|
|||||||
|
|
||||||
protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();
|
protected override Framework.Graphics.UserInterface.Menu CreateSubMenu() => new SubMenu();
|
||||||
|
|
||||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableSubMenuItem(item);
|
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item)
|
||||||
|
|
||||||
private class DrawableSubMenuItem : DrawableOsuMenuItem
|
|
||||||
{
|
{
|
||||||
public DrawableSubMenuItem(MenuItem item)
|
switch (item)
|
||||||
|
{
|
||||||
|
case EditorMenuItemSpacer spacer:
|
||||||
|
return new DrawableSpacer(spacer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.CreateDrawableMenuItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DrawableSpacer : DrawableOsuMenuItem
|
||||||
|
{
|
||||||
|
public DrawableSpacer(MenuItem item)
|
||||||
: base(item)
|
: base(item)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e) => true;
|
||||||
{
|
|
||||||
if (Item is EditorMenuItemSpacer)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return base.OnHover(e);
|
protected override bool OnClick(ClickEvent e) => true;
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
|
||||||
{
|
|
||||||
if (Item is EditorMenuItemSpacer)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return base.OnClick(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,17 +7,19 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components
|
namespace osu.Game.Screens.Edit.Compose.Components
|
||||||
{
|
{
|
||||||
public class SelectionBox : CompositeDrawable
|
public class SelectionBox : CompositeDrawable
|
||||||
{
|
{
|
||||||
public Action<float> OnRotation;
|
public Func<float, bool> OnRotation;
|
||||||
public Action<Vector2, Anchor> OnScale;
|
public Func<Vector2, Anchor, bool> OnScale;
|
||||||
public Action<Direction> OnFlip;
|
public Func<Direction, bool> OnFlip;
|
||||||
public Action OnReverse;
|
public Func<bool> OnReverse;
|
||||||
|
|
||||||
public Action OperationStarted;
|
public Action OperationStarted;
|
||||||
public Action OperationEnded;
|
public Action OperationEnded;
|
||||||
@ -105,6 +107,26 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
recreate();
|
recreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
{
|
||||||
|
if (e.Repeat || !e.ControlPressed)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch (e.Key)
|
||||||
|
{
|
||||||
|
case Key.G:
|
||||||
|
return CanReverse && OnReverse?.Invoke() == true;
|
||||||
|
|
||||||
|
case Key.H:
|
||||||
|
return CanScaleX && OnFlip?.Invoke(Direction.Horizontal) == true;
|
||||||
|
|
||||||
|
case Key.J:
|
||||||
|
return CanScaleY && OnFlip?.Invoke(Direction.Vertical) == true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnKeyDown(e);
|
||||||
|
}
|
||||||
|
|
||||||
private void recreate()
|
private void recreate()
|
||||||
{
|
{
|
||||||
if (LoadState < LoadState.Loading)
|
if (LoadState < LoadState.Loading)
|
||||||
@ -143,7 +165,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (CanScaleX && CanScaleY) addFullScaleComponents();
|
if (CanScaleX && CanScaleY) addFullScaleComponents();
|
||||||
if (CanScaleY) addYScaleComponents();
|
if (CanScaleY) addYScaleComponents();
|
||||||
if (CanRotate) addRotationComponents();
|
if (CanRotate) addRotationComponents();
|
||||||
if (CanReverse) addButton(FontAwesome.Solid.Backward, "Reverse pattern", () => OnReverse?.Invoke());
|
if (CanReverse) addButton(FontAwesome.Solid.Backward, "Reverse pattern (Ctrl-G)", () => OnReverse?.Invoke());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRotationComponents()
|
private void addRotationComponents()
|
||||||
@ -178,7 +200,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
private void addYScaleComponents()
|
private void addYScaleComponents()
|
||||||
{
|
{
|
||||||
addButton(FontAwesome.Solid.ArrowsAltV, "Flip vertically", () => OnFlip?.Invoke(Direction.Vertical));
|
addButton(FontAwesome.Solid.ArrowsAltV, "Flip vertically (Ctrl-J)", () => OnFlip?.Invoke(Direction.Vertical));
|
||||||
|
|
||||||
addDragHandle(Anchor.TopCentre);
|
addDragHandle(Anchor.TopCentre);
|
||||||
addDragHandle(Anchor.BottomCentre);
|
addDragHandle(Anchor.BottomCentre);
|
||||||
@ -194,7 +216,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
private void addXScaleComponents()
|
private void addXScaleComponents()
|
||||||
{
|
{
|
||||||
addButton(FontAwesome.Solid.ArrowsAltH, "Flip horizontally", () => OnFlip?.Invoke(Direction.Horizontal));
|
addButton(FontAwesome.Solid.ArrowsAltH, "Flip horizontally (Ctrl-H)", () => OnFlip?.Invoke(Direction.Horizontal));
|
||||||
|
|
||||||
addDragHandle(Anchor.CentreLeft);
|
addDragHandle(Anchor.CentreLeft);
|
||||||
addDragHandle(Anchor.CentreRight);
|
addDragHandle(Anchor.CentreRight);
|
||||||
|
@ -99,10 +99,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
OperationStarted = OnOperationBegan,
|
OperationStarted = OnOperationBegan,
|
||||||
OperationEnded = OnOperationEnded,
|
OperationEnded = OnOperationEnded,
|
||||||
|
|
||||||
OnRotation = angle => HandleRotation(angle),
|
OnRotation = HandleRotation,
|
||||||
OnScale = (amount, anchor) => HandleScale(amount, anchor),
|
OnScale = HandleScale,
|
||||||
OnFlip = direction => HandleFlip(direction),
|
OnFlip = HandleFlip,
|
||||||
OnReverse = () => HandleReverse(),
|
OnReverse = HandleReverse,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Audio;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -67,8 +68,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
private TimelineControlPointDisplay controlPoints;
|
private TimelineControlPointDisplay controlPoints;
|
||||||
|
|
||||||
|
private Bindable<float> waveformOpacity;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours)
|
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
@ -95,7 +98,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
// We don't want the centre marker to scroll
|
// We don't want the centre marker to scroll
|
||||||
AddInternal(new CentreMarker { Depth = float.MaxValue });
|
AddInternal(new CentreMarker { Depth = float.MaxValue });
|
||||||
|
|
||||||
WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
||||||
|
waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true);
|
||||||
|
|
||||||
|
WaveformVisible.ValueChanged += _ => updateWaveformOpacity();
|
||||||
ControlPointsVisible.ValueChanged += visible => controlPoints.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
ControlPointsVisible.ValueChanged += visible => controlPoints.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
||||||
TicksVisible.ValueChanged += visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
TicksVisible.ValueChanged += visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
||||||
|
|
||||||
@ -115,6 +121,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateWaveformOpacity() =>
|
||||||
|
waveform.FadeTo(WaveformVisible.Value ? waveformOpacity.Value : 0, 200, Easing.OutQuint);
|
||||||
|
|
||||||
private float getZoomLevelForVisibleMilliseconds(double milliseconds) => Math.Max(1, (float)(track.Length / milliseconds));
|
private float getZoomLevelForVisibleMilliseconds(double milliseconds) => Math.Max(1, (float)(track.Length / milliseconds));
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -113,19 +113,19 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
protected override bool OnScroll(ScrollEvent e)
|
protected override bool OnScroll(ScrollEvent e)
|
||||||
{
|
{
|
||||||
if (e.IsPrecise)
|
if (e.AltPressed)
|
||||||
{
|
{
|
||||||
// can't handle scroll correctly while playing.
|
// zoom when holding alt.
|
||||||
// the editor will handle this case for us.
|
setZoomTarget(zoomTarget + e.ScrollDelta.Y, zoomedContent.ToLocalSpace(e.ScreenSpaceMousePosition).X);
|
||||||
if (editorClock?.IsRunning == true)
|
return true;
|
||||||
return false;
|
|
||||||
|
|
||||||
// for now, we don't support zoom when using a precision scroll device. this needs gesture support.
|
|
||||||
return base.OnScroll(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setZoomTarget(zoomTarget + e.ScrollDelta.Y, zoomedContent.ToLocalSpace(e.ScreenSpaceMousePosition).X);
|
// can't handle scroll correctly while playing.
|
||||||
return true;
|
// the editor will handle this case for us.
|
||||||
|
if (editorClock?.IsRunning == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return base.OnScroll(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateZoomedContentWidth() => zoomedContent.Width = DrawWidth * currentZoom;
|
private void updateZoomedContentWidth() => zoomedContent.Width = DrawWidth * currentZoom;
|
||||||
|
@ -20,6 +20,7 @@ using osu.Framework.Platform;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -103,7 +104,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
private MusicController music { get; set; }
|
private MusicController music { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, GameHost host)
|
private void load(OsuColour colours, GameHost host, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;
|
beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;
|
||||||
beatDivisor.BindValueChanged(divisor => Beatmap.Value.BeatmapInfo.BeatDivisor = divisor.NewValue);
|
beatDivisor.BindValueChanged(divisor => Beatmap.Value.BeatmapInfo.BeatDivisor = divisor.NewValue);
|
||||||
@ -208,6 +209,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
copyMenuItem = new EditorMenuItem("Copy", MenuItemType.Standard, Copy),
|
copyMenuItem = new EditorMenuItem("Copy", MenuItemType.Standard, Copy),
|
||||||
pasteMenuItem = new EditorMenuItem("Paste", MenuItemType.Standard, Paste),
|
pasteMenuItem = new EditorMenuItem("Paste", MenuItemType.Standard, Paste),
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
new MenuItem("View")
|
||||||
|
{
|
||||||
|
Items = new[]
|
||||||
|
{
|
||||||
|
new WaveformOpacityMenu(config)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
46
osu.Game/Screens/Edit/WaveformOpacityMenu.cs
Normal file
46
osu.Game/Screens/Edit/WaveformOpacityMenu.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit
|
||||||
|
{
|
||||||
|
internal class WaveformOpacityMenu : MenuItem
|
||||||
|
{
|
||||||
|
private readonly Bindable<float> waveformOpacity;
|
||||||
|
|
||||||
|
private readonly Dictionary<float, ToggleMenuItem> menuItemLookup = new Dictionary<float, ToggleMenuItem>();
|
||||||
|
|
||||||
|
public WaveformOpacityMenu(OsuConfigManager config)
|
||||||
|
: base("Waveform opacity")
|
||||||
|
{
|
||||||
|
Items = new[]
|
||||||
|
{
|
||||||
|
createMenuItem(0.25f),
|
||||||
|
createMenuItem(0.5f),
|
||||||
|
createMenuItem(0.75f),
|
||||||
|
createMenuItem(1f),
|
||||||
|
};
|
||||||
|
|
||||||
|
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
||||||
|
waveformOpacity.BindValueChanged(opacity =>
|
||||||
|
{
|
||||||
|
foreach (var kvp in menuItemLookup)
|
||||||
|
kvp.Value.State.Value = kvp.Key == opacity.NewValue;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ToggleMenuItem createMenuItem(float opacity)
|
||||||
|
{
|
||||||
|
var item = new ToggleMenuItem($"{opacity * 100}%", MenuItemType.Standard, _ => updateOpacity(opacity));
|
||||||
|
menuItemLookup[opacity] = item;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateOpacity(float opacity) => waveformOpacity.Value = opacity;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user