mirror of
https://github.com/osukey/osukey.git
synced 2025-05-26 07:57:32 +09:00
Extract zoom delta method
This commit is contained in:
parent
a4f071fe53
commit
d69dc457ba
@ -20,8 +20,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
private readonly Drawable userContent;
|
private readonly Drawable userContent;
|
||||||
|
|
||||||
private const float zoom_button_sensitivity = 0.02f;
|
|
||||||
|
|
||||||
public TimelineArea(Drawable content = null)
|
public TimelineArea(Drawable content = null)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -156,6 +154,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
Timeline.TicksVisible.BindTo(ticksCheckbox.Current);
|
Timeline.TicksVisible.BindTo(ticksCheckbox.Current);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeZoom(float change) => Timeline.Zoom += change * Timeline.MaxZoom * zoom_button_sensitivity;
|
private void changeZoom(float change) => Timeline.Zoom += Timeline.CalculateZoomChange(change);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
set => updateZoom(value);
|
set => updateZoom(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private const float zoom_scroll_sensitivity = 0.02f;
|
private const float zoom_change_sensitivity = 0.02f;
|
||||||
|
|
||||||
private void updateZoom(float? value = null)
|
private void updateZoom(float? value = null)
|
||||||
{
|
{
|
||||||
@ -129,7 +129,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
if (e.AltPressed)
|
if (e.AltPressed)
|
||||||
{
|
{
|
||||||
// zoom when holding alt.
|
// zoom when holding alt.
|
||||||
setZoomTarget(zoomTarget + e.ScrollDelta.Y * MaxZoom * zoom_scroll_sensitivity, zoomedContent.ToLocalSpace(e.ScreenSpaceMousePosition).X);
|
setZoomTarget(zoomTarget + CalculateZoomChange(e.ScrollDelta.Y), zoomedContent.ToLocalSpace(e.ScreenSpaceMousePosition).X);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,6 +167,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float CalculateZoomChange(float rawChange) => rawChange * MaxZoom * zoom_change_sensitivity;
|
||||||
|
|
||||||
private class TransformZoom : Transform<float, ZoomableScrollContainer>
|
private class TransformZoom : Transform<float, ZoomableScrollContainer>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user