1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-08 06:19:38 +08:00

Merge pull request #18438 from Susko3/use-normalised-precise-scrolling

Adjust `ScrollDelta` usages to account for normalised `IsPrecise` values
This commit is contained in:
Dean Herbert 2022-05-28 01:10:10 +09:00 committed by GitHub
commit f708b98058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 9 deletions

View File

@ -52,7 +52,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.525.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2022.527.0" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Transitive Dependencies"> <ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. --> <!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->

View File

@ -329,7 +329,7 @@ namespace osu.Game.Overlays.Volume
if (isPrecise) if (isPrecise)
{ {
scrollAccumulation += delta * adjust_step * 0.1; scrollAccumulation += delta * adjust_step;
while (Precision.AlmostBigger(Math.Abs(scrollAccumulation), precision)) while (Precision.AlmostBigger(Math.Abs(scrollAccumulation), precision))
{ {

View File

@ -26,6 +26,8 @@ namespace osu.Game.Rulesets.Edit
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
{ {
private const float adjust_step = 0.1f;
public Bindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1.0) public Bindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1.0)
{ {
MinValue = 0.1, MinValue = 0.1,
@ -61,7 +63,7 @@ namespace osu.Game.Rulesets.Edit
Child = distanceSpacingSlider = new ExpandableSlider<double, SizeSlider<double>> Child = distanceSpacingSlider = new ExpandableSlider<double, SizeSlider<double>>
{ {
Current = { BindTarget = DistanceSpacingMultiplier }, Current = { BindTarget = DistanceSpacingMultiplier },
KeyboardStep = 0.1f, KeyboardStep = adjust_step,
} }
} }
}); });
@ -93,7 +95,7 @@ namespace osu.Game.Rulesets.Edit
{ {
case GlobalAction.EditorIncreaseDistanceSpacing: case GlobalAction.EditorIncreaseDistanceSpacing:
case GlobalAction.EditorDecreaseDistanceSpacing: case GlobalAction.EditorDecreaseDistanceSpacing:
return adjustDistanceSpacing(e.Action, 0.1f); return adjustDistanceSpacing(e.Action, adjust_step);
} }
return false; return false;
@ -109,7 +111,7 @@ namespace osu.Game.Rulesets.Edit
{ {
case GlobalAction.EditorIncreaseDistanceSpacing: case GlobalAction.EditorIncreaseDistanceSpacing:
case GlobalAction.EditorDecreaseDistanceSpacing: case GlobalAction.EditorDecreaseDistanceSpacing:
return adjustDistanceSpacing(e.Action, e.ScrollAmount * (e.IsPrecise ? 0.01f : 0.1f)); return adjustDistanceSpacing(e.Action, e.ScrollAmount * adjust_step);
} }
return false; return false;

View File

@ -493,7 +493,7 @@ namespace osu.Game.Screens.Edit
if (scrollAccumulation != 0 && Math.Sign(scrollAccumulation) != scrollDirection) if (scrollAccumulation != 0 && Math.Sign(scrollAccumulation) != scrollDirection)
scrollAccumulation = scrollDirection * (precision - Math.Abs(scrollAccumulation)); scrollAccumulation = scrollDirection * (precision - Math.Abs(scrollAccumulation));
scrollAccumulation += scrollComponent * (e.IsPrecise ? 0.1 : 1); scrollAccumulation += scrollComponent;
// because we are doing snapped seeking, we need to add up precise scrolls until they accumulate to an arbitrary cut-off. // because we are doing snapped seeking, we need to add up precise scrolls until they accumulate to an arbitrary cut-off.
while (Math.Abs(scrollAccumulation) >= precision) while (Math.Abs(scrollAccumulation) >= precision)

View File

@ -35,7 +35,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Realm" Version="10.11.2" /> <PackageReference Include="Realm" Version="10.11.2" />
<PackageReference Include="ppy.osu.Framework" Version="2022.525.0" /> <PackageReference Include="ppy.osu.Framework" Version="2022.527.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" />
<PackageReference Include="Sentry" Version="3.17.1" /> <PackageReference Include="Sentry" Version="3.17.1" />
<PackageReference Include="SharpCompress" Version="0.31.0" /> <PackageReference Include="SharpCompress" Version="0.31.0" />

View File

@ -61,7 +61,7 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.525.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2022.527.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2022.527.0" />
</ItemGroup> </ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) --> <!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
@ -84,7 +84,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.14" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="5.0.14" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="5.0.14" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2022.525.0" /> <PackageReference Include="ppy.osu.Framework" Version="2022.527.0" />
<PackageReference Include="SharpCompress" Version="0.31.0" /> <PackageReference Include="SharpCompress" Version="0.31.0" />
<PackageReference Include="NUnit" Version="3.13.3" /> <PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />