mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +08:00
Merge branch 'master' into snapping-tidy-distance
This commit is contained in:
commit
39d10487b9
@ -89,9 +89,9 @@ namespace osu.Game.Rulesets.Catch.Edit
|
|||||||
new TernaryButton(distanceSnapToggle, "Distance Snap", () => new SpriteIcon { Icon = FontAwesome.Solid.Ruler })
|
new TernaryButton(distanceSnapToggle, "Distance Snap", () => new SpriteIcon { Icon = FontAwesome.Solid.Ruler })
|
||||||
});
|
});
|
||||||
|
|
||||||
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
|
public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
var result = base.SnapScreenSpacePositionToValidTime(screenSpacePosition);
|
var result = base.FindSnappedPositionAndTime(screenSpacePosition);
|
||||||
result.ScreenSpacePosition.X = screenSpacePosition.X;
|
result.ScreenSpacePosition.X = screenSpacePosition.X;
|
||||||
|
|
||||||
if (distanceSnapGrid.IsPresent && distanceSnapGrid.GetSnappedPosition(result.ScreenSpacePosition) is SnapResult snapResult &&
|
if (distanceSnapGrid.IsPresent && distanceSnapGrid.GetSnappedPosition(result.ScreenSpacePosition) is SnapResult snapResult &&
|
||||||
|
@ -97,12 +97,12 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
|||||||
set => InternalChild = value;
|
set => InternalChild = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
|
public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition)
|
public override SnapResult FindSnappedPosition(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,9 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) =>
|
protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) =>
|
||||||
Playfield.GetColumnByPosition(screenSpacePosition);
|
Playfield.GetColumnByPosition(screenSpacePosition);
|
||||||
|
|
||||||
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
|
public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
var result = base.SnapScreenSpacePositionToValidTime(screenSpacePosition);
|
var result = base.FindSnappedPositionAndTime(screenSpacePosition);
|
||||||
|
|
||||||
switch (ScrollingInfo.Direction.Value)
|
switch (ScrollingInfo.Direction.Value)
|
||||||
{
|
{
|
||||||
@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = SnapScreenSpacePositionToValidTime(inputManager.CurrentState.Mouse.Position);
|
var result = FindSnappedPositionAndTime(inputManager.CurrentState.Mouse.Position);
|
||||||
if (result.Time is double time)
|
if (result.Time is double time)
|
||||||
beatSnapGrid.SelectionTimeRange = (time, time);
|
beatSnapGrid.SelectionTimeRange = (time, time);
|
||||||
else
|
else
|
||||||
|
@ -182,10 +182,10 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
|
|
||||||
private class SnapProvider : IDistanceSnapProvider
|
private class SnapProvider : IDistanceSnapProvider
|
||||||
{
|
{
|
||||||
public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) =>
|
public SnapResult FindSnappedPosition(Vector2 screenSpacePosition) =>
|
||||||
new SnapResult(screenSpacePosition, null);
|
new SnapResult(screenSpacePosition, null);
|
||||||
|
|
||||||
public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0);
|
public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0);
|
||||||
|
|
||||||
public IBindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1);
|
public IBindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1);
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
{
|
{
|
||||||
// Special handling for selections containing head control point - the position of the slider changes which means the snapped position and time have to be taken into account
|
// Special handling for selections containing head control point - the position of the slider changes which means the snapped position and time have to be taken into account
|
||||||
Vector2 newHeadPosition = Parent.ToScreenSpace(e.MousePosition + (dragStartPositions[0] - dragStartPositions[draggedControlPointIndex]));
|
Vector2 newHeadPosition = Parent.ToScreenSpace(e.MousePosition + (dragStartPositions[0] - dragStartPositions[draggedControlPointIndex]));
|
||||||
var result = snapProvider?.SnapScreenSpacePositionToValidTime(newHeadPosition);
|
var result = snapProvider?.FindSnappedPositionAndTime(newHeadPosition);
|
||||||
|
|
||||||
Vector2 movementDelta = Parent.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - slider.Position;
|
Vector2 movementDelta = Parent.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - slider.Position;
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition)
|
public override SnapResult FindSnappedPosition(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
if (snapToVisibleBlueprints(screenSpacePosition, out var snapResult))
|
if (snapToVisibleBlueprints(screenSpacePosition, out var snapResult))
|
||||||
return snapResult;
|
return snapResult;
|
||||||
@ -131,9 +131,9 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
return new SnapResult(screenSpacePosition, null);
|
return new SnapResult(screenSpacePosition, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
|
public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
var positionSnap = SnapScreenSpacePositionToValidPosition(screenSpacePosition);
|
var positionSnap = FindSnappedPosition(screenSpacePosition);
|
||||||
if (positionSnap.ScreenSpacePosition != screenSpacePosition)
|
if (positionSnap.ScreenSpacePosition != screenSpacePosition)
|
||||||
return positionSnap;
|
return positionSnap;
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
return new SnapResult(rectangularPositionSnapGrid.ToScreenSpace(pos), null, PlayfieldAtScreenSpacePosition(screenSpacePosition));
|
return new SnapResult(rectangularPositionSnapGrid.ToScreenSpace(pos), null, PlayfieldAtScreenSpacePosition(screenSpacePosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.SnapScreenSpacePositionToValidTime(screenSpacePosition);
|
return base.FindSnappedPositionAndTime(screenSpacePosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool snapToVisibleBlueprints(Vector2 screenSpacePosition, out SnapResult snapResult)
|
private bool snapToVisibleBlueprints(Vector2 screenSpacePosition, out SnapResult snapResult)
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -23,9 +22,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => @"Strict Tracking";
|
public override string Name => @"Strict Tracking";
|
||||||
public override string Acronym => @"ST";
|
public override string Acronym => @"ST";
|
||||||
public override IconUsage? Icon => FontAwesome.Solid.PenFancy;
|
|
||||||
public override ModType Type => ModType.DifficultyIncrease;
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => @"Follow circles just got serious...";
|
public override string Description => @"Once you start a slider, follow precisely or get a miss.";
|
||||||
public override double ScoreMultiplier => 1.0;
|
public override double ScoreMultiplier => 1.0;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModClassic), typeof(OsuModTarget) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModClassic), typeof(OsuModTarget) };
|
||||||
|
|
||||||
|
@ -162,10 +162,10 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
|
|
||||||
private class SnapProvider : IDistanceSnapProvider
|
private class SnapProvider : IDistanceSnapProvider
|
||||||
{
|
{
|
||||||
public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) =>
|
public SnapResult FindSnappedPosition(Vector2 screenSpacePosition) =>
|
||||||
new SnapResult(screenSpacePosition, null);
|
new SnapResult(screenSpacePosition, null);
|
||||||
|
|
||||||
public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0);
|
public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) => new SnapResult(screenSpacePosition, 0);
|
||||||
|
|
||||||
public IBindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1);
|
public IBindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1);
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
cacheDownloadRequest.PerformAsync();
|
Task.Run(() => cacheDownloadRequest.PerformAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool checkLocalCache(BeatmapSetInfo set, BeatmapInfo beatmapInfo)
|
private bool checkLocalCache(BeatmapSetInfo set, BeatmapInfo beatmapInfo)
|
||||||
|
@ -23,7 +23,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// Represents a <see cref="HitObjectComposer{TObject}"/> for rulesets with the concept of distances between objects.
|
/// Represents a <see cref="HitObjectComposer{TObject}"/> for rulesets with the concept of distances between objects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TObject">The base type of supported objects.</typeparam>
|
/// <typeparam name="TObject">The base type of supported objects.</typeparam>
|
||||||
[Cached(typeof(IDistanceSnapProvider))]
|
|
||||||
public abstract class DistancedHitObjectComposer<TObject> : HitObjectComposer<TObject>, IDistanceSnapProvider, IScrollBindingHandler<GlobalAction>
|
public abstract class DistancedHitObjectComposer<TObject> : HitObjectComposer<TObject>, IDistanceSnapProvider, IScrollBindingHandler<GlobalAction>
|
||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// Responsible for providing snapping and generally gluing components together.
|
/// Responsible for providing snapping and generally gluing components together.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TObject">The base type of supported objects.</typeparam>
|
/// <typeparam name="TObject">The base type of supported objects.</typeparam>
|
||||||
[Cached(Type = typeof(IPlacementHandler))]
|
|
||||||
public abstract class HitObjectComposer<TObject> : HitObjectComposer, IPlacementHandler
|
public abstract class HitObjectComposer<TObject> : HitObjectComposer, IPlacementHandler
|
||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
@ -362,7 +361,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// <returns>The most relevant <see cref="Playfield"/>.</returns>
|
/// <returns>The most relevant <see cref="Playfield"/>.</returns>
|
||||||
protected virtual Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) => drawableRulesetWrapper.Playfield;
|
protected virtual Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) => drawableRulesetWrapper.Playfield;
|
||||||
|
|
||||||
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
|
public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
var playfield = PlayfieldAtScreenSpacePosition(screenSpacePosition);
|
var playfield = PlayfieldAtScreenSpacePosition(screenSpacePosition);
|
||||||
double? targetTime = null;
|
double? targetTime = null;
|
||||||
@ -388,8 +387,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// A non-generic definition of a HitObject composer class.
|
/// A non-generic definition of a HitObject composer class.
|
||||||
/// Generally used to access certain methods without requiring a generic type for <see cref="HitObjectComposer{T}" />.
|
/// Generally used to access certain methods without requiring a generic type for <see cref="HitObjectComposer{T}" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Cached(typeof(HitObjectComposer))]
|
[Cached]
|
||||||
[Cached(typeof(IPositionSnapProvider))]
|
|
||||||
public abstract class HitObjectComposer : CompositeDrawable, IPositionSnapProvider
|
public abstract class HitObjectComposer : CompositeDrawable, IPositionSnapProvider
|
||||||
{
|
{
|
||||||
protected HitObjectComposer()
|
protected HitObjectComposer()
|
||||||
@ -416,9 +414,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
#region IPositionSnapProvider
|
#region IPositionSnapProvider
|
||||||
|
|
||||||
public abstract SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition);
|
public abstract SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition);
|
||||||
|
|
||||||
public virtual SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) =>
|
public virtual SnapResult FindSnappedPosition(Vector2 screenSpacePosition) =>
|
||||||
new SnapResult(screenSpacePosition, null);
|
new SnapResult(screenSpacePosition, null);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -10,6 +11,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A snap provider which given a reference hit object and proposed distance from it, offers a more correct duration or distance value.
|
/// A snap provider which given a reference hit object and proposed distance from it, offers a more correct duration or distance value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Cached]
|
||||||
public interface IDistanceSnapProvider : IPositionSnapProvider
|
public interface IDistanceSnapProvider : IPositionSnapProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,27 +1,33 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
namespace osu.Game.Rulesets.Edit
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A snap provider which given a proposed position for a hit object, potentially offers a more correct position and time value inferred from the context of the beatmap.
|
||||||
|
/// Provided values are inferred in an isolated context, without consideration of other nearby hit objects.
|
||||||
|
/// </summary>
|
||||||
|
[Cached]
|
||||||
public interface IPositionSnapProvider
|
public interface IPositionSnapProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a position, find a valid time and position snap.
|
/// Given a position, find a valid time and position snap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This call should be equivalent to running <see cref="SnapScreenSpacePositionToValidPosition"/> with any additional logic that can be performed without the time immutability restriction.
|
/// This call should be equivalent to running <see cref="FindSnappedPosition"/> with any additional logic that can be performed without the time immutability restriction.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="screenSpacePosition">The screen-space position to be snapped.</param>
|
/// <param name="screenSpacePosition">The screen-space position to be snapped.</param>
|
||||||
/// <returns>The time and position post-snapping.</returns>
|
/// <returns>The time and position post-snapping.</returns>
|
||||||
SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition);
|
SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a position, find a value position snap, restricting time to its input value.
|
/// Given a position, find a valid position snap, without changing the time value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="screenSpacePosition">The screen-space position to be snapped.</param>
|
/// <param name="screenSpacePosition">The screen-space position to be snapped.</param>
|
||||||
/// <returns>The position post-snapping. Time will always be null.</returns>
|
/// <returns>The position post-snapping. Time will always be null.</returns>
|
||||||
SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition);
|
SnapResult FindSnappedPosition(Vector2 screenSpacePosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
Vector2 originalPosition = movementBlueprintOriginalPositions[i];
|
Vector2 originalPosition = movementBlueprintOriginalPositions[i];
|
||||||
var testPosition = originalPosition + distanceTravelled;
|
var testPosition = originalPosition + distanceTravelled;
|
||||||
|
|
||||||
var positionalResult = snapProvider.SnapScreenSpacePositionToValidPosition(testPosition);
|
var positionalResult = snapProvider.FindSnappedPosition(testPosition);
|
||||||
|
|
||||||
if (positionalResult.ScreenSpacePosition == testPosition) continue;
|
if (positionalResult.ScreenSpacePosition == testPosition) continue;
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
Vector2 movePosition = movementBlueprintOriginalPositions.First() + distanceTravelled;
|
Vector2 movePosition = movementBlueprintOriginalPositions.First() + distanceTravelled;
|
||||||
|
|
||||||
// Retrieve a snapped position.
|
// Retrieve a snapped position.
|
||||||
var result = snapProvider?.SnapScreenSpacePositionToValidTime(movePosition);
|
var result = snapProvider?.FindSnappedPositionAndTime(movePosition);
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
|
@ -214,7 +214,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
private void updatePlacementPosition()
|
private void updatePlacementPosition()
|
||||||
{
|
{
|
||||||
var snapResult = Composer.SnapScreenSpacePositionToValidTime(inputManager.CurrentState.Mouse.Position);
|
var snapResult = Composer.FindSnappedPositionAndTime(inputManager.CurrentState.Mouse.Position);
|
||||||
|
|
||||||
// if no time was found from positional snapping, we should still quantize to the beat.
|
// if no time was found from positional snapping, we should still quantize to the beat.
|
||||||
snapResult.Time ??= Beatmap.SnapTime(EditorClock.CurrentTime, null);
|
snapResult.Time ??= Beatmap.SnapTime(EditorClock.CurrentTime, null);
|
||||||
|
@ -19,7 +19,6 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
[Cached(typeof(IPositionSnapProvider))]
|
|
||||||
[Cached]
|
[Cached]
|
||||||
public class Timeline : ZoomableScrollContainer, IPositionSnapProvider
|
public class Timeline : ZoomableScrollContainer, IPositionSnapProvider
|
||||||
{
|
{
|
||||||
@ -307,10 +306,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double VisibleRange => track.Length / Zoom;
|
public double VisibleRange => track.Length / Zoom;
|
||||||
|
|
||||||
public SnapResult SnapScreenSpacePositionToValidPosition(Vector2 screenSpacePosition) =>
|
public SnapResult FindSnappedPosition(Vector2 screenSpacePosition) =>
|
||||||
new SnapResult(screenSpacePosition, null);
|
new SnapResult(screenSpacePosition, null);
|
||||||
|
|
||||||
public SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition) =>
|
public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) =>
|
||||||
new SnapResult(screenSpacePosition, beatSnapProvider.SnapTime(getTimeFromPosition(Content.ToLocalSpace(screenSpacePosition))));
|
new SnapResult(screenSpacePosition, beatSnapProvider.SnapTime(getTimeFromPosition(Content.ToLocalSpace(screenSpacePosition))));
|
||||||
|
|
||||||
private double getTimeFromPosition(Vector2 localPosition) =>
|
private double getTimeFromPosition(Vector2 localPosition) =>
|
||||||
|
@ -382,7 +382,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
OnDragHandled?.Invoke(e);
|
OnDragHandled?.Invoke(e);
|
||||||
|
|
||||||
if (timeline.SnapScreenSpacePositionToValidTime(e.ScreenSpaceMousePosition).Time is double time)
|
if (timeline.FindSnappedPositionAndTime(e.ScreenSpaceMousePosition).Time is double time)
|
||||||
{
|
{
|
||||||
switch (hitObject)
|
switch (hitObject)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose
|
namespace osu.Game.Screens.Edit.Compose
|
||||||
{
|
{
|
||||||
|
[Cached]
|
||||||
public interface IPlacementHandler
|
public interface IPlacementHandler
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -14,7 +14,6 @@ using osu.Game.Screens.Edit.Compose;
|
|||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
[Cached(Type = typeof(IPlacementHandler))]
|
|
||||||
public abstract class PlacementBlueprintTestScene : OsuManualInputManagerTestScene, IPlacementHandler
|
public abstract class PlacementBlueprintTestScene : OsuManualInputManagerTestScene, IPlacementHandler
|
||||||
{
|
{
|
||||||
protected readonly Container HitObjectContainer;
|
protected readonly Container HitObjectContainer;
|
||||||
|
Loading…
Reference in New Issue
Block a user