@@ -59,6 +59,7 @@ public class VideoSettingsScreen extends Screen implements ScreenPromptable {
59
59
private DonationButtonWidget donateButton ;
60
60
61
61
private boolean hasPendingChanges ;
62
+ private boolean reserveBottomSpace ;
62
63
63
64
private final ScrollableTooltip tooltip = new ScrollableTooltip (this );
64
65
@@ -190,15 +191,34 @@ private void rebuild() {
190
191
191
192
this .pageList = new PageListWidget (this , this ::startSearch , new Dim2i (0 , 0 , Layout .PAGE_LIST_WIDTH , this .height ));
192
193
193
- this .applyButton = new FlatButtonWidget (new Dim2i (Layout .PAGE_LIST_WIDTH + Layout .INNER_MARGIN , Layout .INNER_MARGIN , Layout .BUTTON_LONG , Layout .BUTTON_SHORT ), Component .translatable ("sodium.options.buttons.apply" ), ConfigManager .CONFIG ::applyAllOptions , true , false );
194
- this .closeButton = new FlatButtonWidget (new Dim2i (this .applyButton .getLimitX () + Layout .INNER_MARGIN , Layout .INNER_MARGIN , Layout .BUTTON_LONG , Layout .BUTTON_SHORT ), Component .translatable ("gui.done" ), this ::onClose , true , false );
195
- this .undoButton = new FlatButtonWidget (new Dim2i (this .closeButton .getLimitX () + Layout .INNER_MARGIN , Layout .INNER_MARGIN , Layout .BUTTON_LONG , Layout .BUTTON_SHORT ), Component .translatable ("sodium.options.buttons.undo" ), this ::undoChanges , true , false );
194
+ boolean stackVertically = false ;
195
+ this .reserveBottomSpace = false ;
196
196
197
- this .donateButton = new DonationButtonWidget (this , List .of (this .applyButton , this .closeButton , this .undoButton ), this .width , this ::openDonationPage );
197
+ int minWidthToStack = Layout .PAGE_LIST_WIDTH + Layout .INNER_MARGIN * 2 + Layout .OPTION_WIDTH + Layout .OPTION_LIST_SCROLLBAR_OFFSET + Layout .SCROLLBAR_WIDTH + Layout .BUTTON_LONG ;
198
+ int maxWidthToStack = minWidthToStack + Layout .BUTTON_LONG * 2 + Layout .INNER_MARGIN ;
198
199
199
- this .rebuildOptionList ();
200
+ if (this .width > minWidthToStack && this .width < maxWidthToStack ) {
201
+ stackVertically = true ;
202
+ } else if (this .width < minWidthToStack ) {
203
+ this .reserveBottomSpace = true ;
204
+ }
205
+
206
+ this .closeButton = new FlatButtonWidget (new Dim2i (this .width - Layout .BUTTON_LONG - Layout .INNER_MARGIN , this .height - (Layout .INNER_MARGIN + Layout .BUTTON_SHORT ), Layout .BUTTON_LONG , Layout .BUTTON_SHORT ), Component .translatable ("gui.done" ), this ::onClose , true , false );
207
+
208
+ if (stackVertically ) {
209
+ this .applyButton = new FlatButtonWidget (new Dim2i (this .closeButton .getX (), this .closeButton .getY () - (Layout .INNER_MARGIN + Layout .BUTTON_SHORT ), Layout .BUTTON_LONG , Layout .BUTTON_SHORT ), Component .translatable ("sodium.options.buttons.apply" ), ConfigManager .CONFIG ::applyAllOptions , true , false );
210
+ this .undoButton = new FlatButtonWidget (new Dim2i (this .applyButton .getX (), this .applyButton .getY () - (Layout .INNER_MARGIN + Layout .BUTTON_SHORT ), Layout .BUTTON_LONG , Layout .BUTTON_SHORT ), Component .translatable ("sodium.options.buttons.undo" ), this ::undoChanges , true , false );
211
+ } else {
212
+ this .applyButton = new FlatButtonWidget (new Dim2i (this .closeButton .getX () - Layout .INNER_MARGIN - Layout .BUTTON_LONG , this .height - (Layout .INNER_MARGIN + Layout .BUTTON_SHORT ), Layout .BUTTON_LONG , Layout .BUTTON_SHORT ), Component .translatable ("sodium.options.buttons.apply" ), ConfigManager .CONFIG ::applyAllOptions , true , false );
213
+ this .undoButton = new FlatButtonWidget (new Dim2i (this .applyButton .getX () - Layout .INNER_MARGIN - Layout .BUTTON_LONG , this .height - (Layout .INNER_MARGIN + Layout .BUTTON_SHORT ), Layout .BUTTON_LONG , Layout .BUTTON_SHORT ), Component .translatable ("sodium.options.buttons.undo" ), this ::undoChanges , true , false );
214
+ }
215
+
216
+ this .donateButton = new DonationButtonWidget (this , List .of (), this .width , this ::openDonationPage );
200
217
201
218
this .addRenderableWidget (this .pageList );
219
+
220
+ this .rebuildOptionList ();
221
+
202
222
this .addRenderableWidget (this .undoButton );
203
223
this .addRenderableWidget (this .applyButton );
204
224
this .addRenderableWidget (this .closeButton );
@@ -211,8 +231,8 @@ private void rebuild() {
211
231
private void rebuildOptionList () {
212
232
this .removeWidget (this .optionList );
213
233
this .optionList = this .addRenderableWidget (new OptionListWidget (this , new Dim2i (
214
- this .pageList .getLimitX () + Layout .INNER_MARGIN , Layout .INNER_MARGIN * 2 + Layout . BUTTON_SHORT ,
215
- Layout .OPTION_WIDTH + Layout .OPTION_LIST_SCROLLBAR_OFFSET + Layout .SCROLLBAR_WIDTH , this .height - (Layout .INNER_MARGIN * 3 + Layout .BUTTON_SHORT )),
234
+ this .pageList .getLimitX () + Layout .INNER_MARGIN , Layout .INNER_MARGIN ,
235
+ Layout .OPTION_WIDTH + Layout .OPTION_LIST_SCROLLBAR_OFFSET + Layout .SCROLLBAR_WIDTH , this .height - (this . reserveBottomSpace ? ( Layout .INNER_MARGIN * 3 + Layout .BUTTON_SHORT ) : ( Layout . INNER_MARGIN ) )),
216
236
this .currentPage , this .currentMod .theme ()
217
237
));
218
238
this .controlList = this .optionList ;
@@ -249,7 +269,8 @@ private void updateControls(int mouseX, int mouseY) {
249
269
boolean hasChanges = ConfigManager .CONFIG .anyOptionChanged ();
250
270
251
271
this .applyButton .setEnabled (hasChanges );
252
- this .setWidgetPresence (this .undoButton , hasChanges );
272
+ // This breaks the navigation order and doesn't appear to do anything
273
+ //this.setWidgetPresence(this.undoButton, hasChanges);
253
274
this .undoButton .setVisible (hasChanges );
254
275
this .closeButton .setEnabled (!hasChanges );
255
276
0 commit comments