mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
Split zoom updating to named method with value as optional
This commit is contained in:
parent
268a7e1334
commit
d3feb07bc1
@ -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
|
||||
set => updateZoom(value);
|
||||
}
|
||||
|
||||
private void updateZoom(float? value = null)
|
||||
{
|
||||
value = Math.Clamp(value, MinZoom, MaxZoom);
|
||||
float newZoom = Math.Clamp(value ?? Zoom, MinZoom, MaxZoom);
|
||||
|
||||
if (IsLoaded)
|
||||
setZoomTarget(value, ToSpaceOfOtherDrawable(new Vector2(DrawWidth / 2, 0), zoomedContent).X);
|
||||
setZoomTarget(newZoom, ToSpaceOfOtherDrawable(new Vector2(DrawWidth / 2, 0), zoomedContent).X);
|
||||
else
|
||||
currentZoom = zoomTarget = value;
|
||||
}
|
||||
currentZoom = zoomTarget = newZoom;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
Loading…
Reference in New Issue
Block a user