1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 10:03:05 +08:00

Split zoom updating to named method with value as optional

This commit is contained in:
Salman Ahmed 2022-06-15 07:57:16 +03:00
parent 268a7e1334
commit d3feb07bc1

View File

@ -68,7 +68,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
// ensure zoom range is in valid state before updating zoom.
if (MinZoom < MaxZoom)
Zoom = Zoom;
updateZoom();
}
}
@ -89,7 +89,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
// ensure zoom range is in valid state before updating zoom.
if (MaxZoom > MinZoom)
Zoom = Zoom;
updateZoom();
}
}
@ -99,15 +99,17 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public float Zoom
{
get => zoomTarget;
set
{
value = Math.Clamp(value, MinZoom, MaxZoom);
set => updateZoom(value);
}
if (IsLoaded)
setZoomTarget(value, ToSpaceOfOtherDrawable(new Vector2(DrawWidth / 2, 0), zoomedContent).X);
else
currentZoom = zoomTarget = value;
}
private void updateZoom(float? value = null)
{
float newZoom = Math.Clamp(value ?? Zoom, MinZoom, MaxZoom);
if (IsLoaded)
setZoomTarget(newZoom, ToSpaceOfOtherDrawable(new Vector2(DrawWidth / 2, 0), zoomedContent).X);
else
currentZoom = zoomTarget = newZoom;
}
protected override void Update()