@@ -15,6 +15,8 @@ public partial class TimingScreen : EditorScreenWithTimeline
15
15
[ Cached ]
16
16
public readonly Bindable < ControlPointGroup > SelectedGroup = new Bindable < ControlPointGroup > ( ) ;
17
17
18
+ private readonly Bindable < EditorScreenMode > currentEditorMode = new Bindable < EditorScreenMode > ( ) ;
19
+
18
20
[ Resolved ]
19
21
private EditorClock ? editorClock { get ; set ; }
20
22
@@ -41,18 +43,35 @@ public TimingScreen()
41
43
}
42
44
} ;
43
45
46
+ [ BackgroundDependencyLoader ]
47
+ private void load ( Editor ? editor )
48
+ {
49
+ if ( editor != null )
50
+ currentEditorMode . BindTo ( editor . Mode ) ;
51
+ }
52
+
44
53
protected override void LoadComplete ( )
45
54
{
46
55
base . LoadComplete ( ) ;
47
56
48
- if ( editorClock != null )
57
+ // When entering the timing screen, let's choose the closest valid timing point.
58
+ // This will emulate the osu-stable behaviour where a metronome and timing information
59
+ // are presented on entering the screen.
60
+ currentEditorMode . BindValueChanged ( mode =>
49
61
{
50
- // When entering the timing screen, let's choose the closest valid timing point.
51
- // This will emulate the osu-stable behaviour where a metronome and timing information
52
- // are presented on entering the screen.
53
- var nearestTimingPoint = EditorBeatmap . ControlPointInfo . TimingPointAt ( editorClock . CurrentTime ) ;
54
- SelectedGroup . Value = EditorBeatmap . ControlPointInfo . GroupAt ( nearestTimingPoint . Time ) ;
55
- }
62
+ if ( mode . NewValue == EditorScreenMode . Timing )
63
+ selectClosestTimingPoint ( ) ;
64
+ } ) ;
65
+ selectClosestTimingPoint ( ) ;
66
+ }
67
+
68
+ private void selectClosestTimingPoint ( )
69
+ {
70
+ if ( editorClock == null )
71
+ return ;
72
+
73
+ var nearestTimingPoint = EditorBeatmap . ControlPointInfo . TimingPointAt ( editorClock . CurrentTime ) ;
74
+ SelectedGroup . Value = EditorBeatmap . ControlPointInfo . GroupAt ( nearestTimingPoint . Time ) ;
56
75
}
57
76
58
77
protected override void ConfigureTimeline ( TimelineArea timelineArea )
0 commit comments