File tree Expand file tree Collapse file tree
osu.Framework/Graphics/UserInterface Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// See the LICENCE file in the repository root for full licence text.
33
44using System . Collections . Generic ;
5+ using osu . Framework . Allocation ;
56using osu . Framework . Bindables ;
67using osu . Framework . Graphics . Containers ;
78
@@ -22,16 +23,20 @@ public Bindable<Colour4> Current
2223 set => current . Current = value ;
2324 }
2425
25- private readonly HSVColourPicker hsvColourPicker ;
26- private readonly SwatchColourPicker ? swatchColourPicker ;
27- private readonly HexColourPicker hexColourPicker ;
26+ private HSVColourPicker hsvColourPicker = null ! ;
27+ private HexColourPicker hexColourPicker = null ! ;
28+ private SwatchColourPicker ? swatchColourPicker ;
2829
2930 protected ColourPicker ( )
3031 {
3132 Current . Value = Colour4 . White ;
3233 AutoSizeAxes = Axes . Y ;
3334 Width = 300 ;
35+ }
3436
37+ [ BackgroundDependencyLoader ]
38+ private void load ( )
39+ {
3540 hsvColourPicker = CreateHSVColourPicker ( ) . With ( d =>
3641 {
3742 d . RelativeSizeAxes = Axes . X ;
@@ -72,7 +77,7 @@ protected ColourPicker()
7277 protected abstract HSVColourPicker CreateHSVColourPicker ( ) ;
7378
7479 /// <summary>
75- /// Creates an optional control that shows clickable colour presets.
80+ /// Creates the optional control that shows clickable colour presets.
7681 /// </summary>
7782 protected virtual SwatchColourPicker ? CreateSwatchColourPicker ( ) => null ;
7883
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public Bindable<Colour4> Current
2929 /// <summary>
3030 /// The preset colours to display as swatches.
3131 /// </summary>
32- public BindableList < Colour4 > Colours { get ; }
32+ public BindableList < Colour4 > Colours { get ; } = new BindableList < Colour4 > ( ) ;
3333
3434 /// <summary>
3535 /// The background of the control.
@@ -41,10 +41,8 @@ public Bindable<Colour4> Current
4141 /// </summary>
4242 protected FillFlowContainer Content { get ; }
4343
44- protected SwatchColourPicker ( BindableList < Colour4 > ? colours = null )
44+ protected SwatchColourPicker ( )
4545 {
46- Colours = colours ?? new BindableList < Colour4 > ( ) ;
47-
4846 RelativeSizeAxes = Axes . X ;
4947 AutoSizeAxes = Axes . Y ;
5048
You can’t perform that action at this time.
0 commit comments