1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Make zoom sensitivity relative to containers max zoom

This commit is contained in:
Adam Baker 2022-07-21 08:26:48 -05:00
parent 5db4d9437a
commit a4f071fe53
2 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private readonly Drawable userContent;
private const float zoom_button_sensitivity = 0.02f;
public TimelineArea(Drawable content = null)
{
RelativeSizeAxes = Axes.X;
@ -154,6 +156,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
Timeline.TicksVisible.BindTo(ticksCheckbox.Current);
}
private void changeZoom(float change) => Timeline.Zoom += change;
private void changeZoom(float change) => Timeline.Zoom += change * Timeline.MaxZoom * zoom_button_sensitivity;
}
}

View File

@ -104,6 +104,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
set => updateZoom(value);
}
private const float zoom_scroll_sensitivity = 0.02f;
private void updateZoom(float? value = null)
{
float newZoom = Math.Clamp(value ?? Zoom, MinZoom, MaxZoom);
@ -127,7 +129,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
if (e.AltPressed)
{
// zoom when holding alt.
setZoomTarget(zoomTarget + e.ScrollDelta.Y, zoomedContent.ToLocalSpace(e.ScreenSpaceMousePosition).X);
setZoomTarget(zoomTarget + e.ScrollDelta.Y * MaxZoom * zoom_scroll_sensitivity, zoomedContent.ToLocalSpace(e.ScreenSpaceMousePosition).X);
return true;
}