1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-19 16:42:55 +08:00

Fix timeline zoom receiving feedback from bindable changes

This causes the focal point zooming to not work (as the focal point is
lost). There's no need to handle ongoing changes to
`BeatmapInfo.TimelineZoom` because it is not a property which is changed
at runtime.
This commit is contained in:
Dean Herbert 2022-07-22 15:21:25 +09:00
parent f87efae115
commit 6eb42d08ce

View File

@ -41,6 +41,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
[Resolved]
private EditorClock editorClock { get; set; }
[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
/// <summary>
/// The timeline's scroll position in the last frame.
/// </summary>
@ -68,8 +71,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
/// </summary>
private float defaultTimelineZoom;
private readonly Bindable<double> timelineZoomScale = new BindableDouble(1.0);
public Timeline(Drawable userContent)
{
this.userContent = userContent;
@ -93,7 +94,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private Bindable<float> waveformOpacity;
[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> beatmap, EditorBeatmap editorBeatmap, OsuColour colours, OsuConfigManager config)
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours, OsuConfigManager config)
{
CentreMarker centreMarker;
@ -154,12 +155,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
}
}, true);
timelineZoomScale.Value = editorBeatmap.BeatmapInfo.TimelineZoom;
timelineZoomScale.BindValueChanged(scale =>
{
Zoom = (float)(defaultTimelineZoom * scale.NewValue);
editorBeatmap.BeatmapInfo.TimelineZoom = scale.NewValue;
}, true);
Zoom = (float)(defaultTimelineZoom * editorBeatmap.BeatmapInfo.TimelineZoom);
}
protected override void LoadComplete()
@ -221,7 +217,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
protected override void OnZoomChanged()
{
base.OnZoomChanged();
timelineZoomScale.Value = Zoom / defaultTimelineZoom;
editorBeatmap.BeatmapInfo.TimelineZoom = Zoom / defaultTimelineZoom;
}
protected override void UpdateAfterChildren()