mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 02:32:55 +08:00
Merge pull request #23837 from peppy/limited-distance-spacing
Add setting to limit distance snapping to current time
This commit is contained in:
commit
26a36a023e
@ -178,6 +178,7 @@ namespace osu.Game.Configuration
|
|||||||
SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f, 0f, 1f, 0.25f);
|
SetDefault(OsuSetting.EditorWaveformOpacity, 0.25f, 0f, 1f, 0.25f);
|
||||||
SetDefault(OsuSetting.EditorShowHitMarkers, true);
|
SetDefault(OsuSetting.EditorShowHitMarkers, true);
|
||||||
SetDefault(OsuSetting.EditorAutoSeekOnPlacement, true);
|
SetDefault(OsuSetting.EditorAutoSeekOnPlacement, true);
|
||||||
|
SetDefault(OsuSetting.EditorLimitedDistanceSnap, false);
|
||||||
|
|
||||||
SetDefault(OsuSetting.LastProcessedMetadataId, -1);
|
SetDefault(OsuSetting.LastProcessedMetadataId, -1);
|
||||||
|
|
||||||
@ -383,5 +384,6 @@ namespace osu.Game.Configuration
|
|||||||
SafeAreaConsiderations,
|
SafeAreaConsiderations,
|
||||||
ComboColourNormalisationAmount,
|
ComboColourNormalisationAmount,
|
||||||
ProfileCoverExpanded,
|
ProfileCoverExpanded,
|
||||||
|
EditorLimitedDistanceSnap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,11 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString RotationSnapped(float newRotation) => new TranslatableString(getKey(@"rotation_snapped"), @"{0:0}° (snapped)", newRotation);
|
public static LocalisableString RotationSnapped(float newRotation) => new TranslatableString(getKey(@"rotation_snapped"), @"{0:0}° (snapped)", newRotation);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Limit distance snap placement to current time"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString LimitedDistanceSnap => new TranslatableString(getKey(@"limited_distance_snap_grid"), @"Limit distance snap placement to current time");
|
||||||
|
|
||||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
public abstract partial class CircularDistanceSnapGrid : DistanceSnapGrid
|
public abstract partial class CircularDistanceSnapGrid : DistanceSnapGrid
|
||||||
{
|
{
|
||||||
|
[Resolved]
|
||||||
|
private EditorClock editorClock { get; set; }
|
||||||
|
|
||||||
protected CircularDistanceSnapGrid(HitObject referenceObject, Vector2 startPosition, double startTime, double? endTime = null)
|
protected CircularDistanceSnapGrid(HitObject referenceObject, Vector2 startPosition, double startTime, double? endTime = null)
|
||||||
: base(referenceObject, startPosition, startTime, endTime)
|
: base(referenceObject, startPosition, startTime, endTime)
|
||||||
{
|
{
|
||||||
@ -98,9 +101,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (travelLength < DistanceBetweenTicks)
|
if (travelLength < DistanceBetweenTicks)
|
||||||
travelLength = DistanceBetweenTicks;
|
travelLength = DistanceBetweenTicks;
|
||||||
|
|
||||||
|
float snappedDistance = LimitedDistanceSnap.Value
|
||||||
|
? SnapProvider.DurationToDistance(ReferenceObject, editorClock.CurrentTime - ReferenceObject.GetEndTime())
|
||||||
// When interacting with the resolved snap provider, the distance spacing multiplier should first be removed
|
// When interacting with the resolved snap provider, the distance spacing multiplier should first be removed
|
||||||
// to allow for snapping at a non-multiplied ratio.
|
// to allow for snapping at a non-multiplied ratio.
|
||||||
float snappedDistance = SnapProvider.FindSnappedDistance(ReferenceObject, travelLength / distanceSpacingMultiplier);
|
: SnapProvider.FindSnappedDistance(ReferenceObject, travelLength / distanceSpacingMultiplier);
|
||||||
|
|
||||||
double snappedTime = StartTime + SnapProvider.DistanceToDuration(ReferenceObject, snappedDistance);
|
double snappedTime = StartTime + SnapProvider.DistanceToDuration(ReferenceObject, snappedDistance);
|
||||||
|
|
||||||
if (snappedTime > LatestEndTime)
|
if (snappedTime > LatestEndTime)
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Extensions.Color4Extensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Layout;
|
using osu.Framework.Layout;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -60,6 +61,18 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private BindableBeatDivisor beatDivisor { get; set; }
|
private BindableBeatDivisor beatDivisor { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When enabled, distance snap should only snap to the current time (as per the editor clock).
|
||||||
|
/// This is to emulate stable behaviour.
|
||||||
|
/// </summary>
|
||||||
|
protected Bindable<bool> LimitedDistanceSnap { get; private set; }
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
LimitedDistanceSnap = config.GetBindable<bool>(OsuSetting.EditorLimitedDistanceSnap);
|
||||||
|
}
|
||||||
|
|
||||||
private readonly LayoutValue gridCache = new LayoutValue(Invalidation.RequiredParentSizeToFit);
|
private readonly LayoutValue gridCache = new LayoutValue(Invalidation.RequiredParentSizeToFit);
|
||||||
|
|
||||||
protected readonly HitObject ReferenceObject;
|
protected readonly HitObject ReferenceObject;
|
||||||
|
@ -185,6 +185,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
private Bindable<float> editorBackgroundDim;
|
private Bindable<float> editorBackgroundDim;
|
||||||
private Bindable<bool> editorHitMarkers;
|
private Bindable<bool> editorHitMarkers;
|
||||||
private Bindable<bool> editorAutoSeekOnPlacement;
|
private Bindable<bool> editorAutoSeekOnPlacement;
|
||||||
|
private Bindable<bool> editorLimitedDistanceSnap;
|
||||||
|
|
||||||
public Editor(EditorLoader loader = null)
|
public Editor(EditorLoader loader = null)
|
||||||
{
|
{
|
||||||
@ -276,6 +277,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
editorBackgroundDim = config.GetBindable<float>(OsuSetting.EditorDim);
|
editorBackgroundDim = config.GetBindable<float>(OsuSetting.EditorDim);
|
||||||
editorHitMarkers = config.GetBindable<bool>(OsuSetting.EditorShowHitMarkers);
|
editorHitMarkers = config.GetBindable<bool>(OsuSetting.EditorShowHitMarkers);
|
||||||
editorAutoSeekOnPlacement = config.GetBindable<bool>(OsuSetting.EditorAutoSeekOnPlacement);
|
editorAutoSeekOnPlacement = config.GetBindable<bool>(OsuSetting.EditorAutoSeekOnPlacement);
|
||||||
|
editorLimitedDistanceSnap = config.GetBindable<bool>(OsuSetting.EditorLimitedDistanceSnap);
|
||||||
|
|
||||||
AddInternal(new OsuContextMenuContainer
|
AddInternal(new OsuContextMenuContainer
|
||||||
{
|
{
|
||||||
@ -337,6 +339,10 @@ namespace osu.Game.Screens.Edit
|
|||||||
new ToggleMenuItem(EditorStrings.AutoSeekOnPlacement)
|
new ToggleMenuItem(EditorStrings.AutoSeekOnPlacement)
|
||||||
{
|
{
|
||||||
State = { BindTarget = editorAutoSeekOnPlacement },
|
State = { BindTarget = editorAutoSeekOnPlacement },
|
||||||
|
},
|
||||||
|
new ToggleMenuItem(EditorStrings.LimitedDistanceSnap)
|
||||||
|
{
|
||||||
|
State = { BindTarget = editorLimitedDistanceSnap },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user