@@ -15,7 +15,18 @@ namespace Reactive.BeatSaber.Components;
1515public record struct BsSegmentedControlItem ( string ? Text , Sprite ? Icon ) ;
1616
1717[ PublicAPI ]
18- public partial class BsSegmentedControl < T > : ReactiveComponent , ISkewedComponent {
18+ public partial class BsSegmentedControl < T > : ReactiveComponent , ISkewedComponent , ILayoutDriver {
19+ #region Layout Driver
20+
21+ public ICollection < ILayoutItem > Children { get ; } = Array . Empty < ILayoutItem > ( ) ;
22+
23+ public ILayoutController ? LayoutController {
24+ get => _repeater . LayoutController ;
25+ set => _repeater . LayoutController = value ;
26+ }
27+
28+ #endregion
29+
1930 #region PublicAPI
2031
2132 [ Required ]
@@ -143,17 +154,20 @@ protected override GameObject Construct() {
143154 var i = x . Value . Index ;
144155 var s = x . Value . TotalCells ;
145156
157+ var horizontal = _repeater . FlexController . FlexDirection is FlexDirection . Row ;
158+ var sprites = BeatSaberResources . Sprites ;
159+
146160 if ( i == 0 && s == 1 ) {
147- return BeatSaberResources . Sprites . background ;
161+ return sprites . background ;
148162 }
149163 if ( i == 0 ) {
150- return BeatSaberResources . Sprites . backgroundLeft ;
164+ return horizontal ? sprites . backgroundLeft : sprites . backgroundTop ;
151165 }
152166 if ( i == s - 1 ) {
153- return BeatSaberResources . Sprites . backgroundRight ;
167+ return horizontal ? sprites . backgroundRight : sprites . backgroundBottom ;
154168 }
155169
156- return BeatSaberResources . Sprites . rectangle ;
170+ return sprites . rectangle ;
157171 } ) ,
158172
159173 Do = x => x . WithPointerEvents (
@@ -166,7 +180,7 @@ protected override GameObject Construct() {
166180 new Label {
167181 Alignment = TextAlignmentOptions . Capline ,
168182 sFontStyle = _skew . Map ( x => x > 0 ? FontStyles . Italic : FontStyles . Normal ) ,
169-
183+
170184 sColor = fgColor ,
171185
172186 sText = item . Map ( x => x ? . Text ) . Where ( x => x != null ) ,
0 commit comments