Skip to content

Commit 282df2c

Browse files
committed
Improve the way osd elements render, in particular - stop the labels + variant pickers wrapping under the 3 checkboxes and looking messy
1 parent d359bcf commit 282df2c

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/css/tabs/osd.css

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,24 @@ button {
423423
width: 100%;
424424
}
425425

426+
.tab-osd .switchable-field-flex {
427+
display: flex;
428+
}
429+
430+
.tab-osd .switchable-field-flex .switchable-field-description {
431+
display: flex;
432+
flex-direction: column;
433+
/*
434+
min width here is counterintuitive/seems to do nothing. but important, stops the variant selects overflowing
435+
see https: //stackoverflow.com/questions/36230944/prevent-flex-items-from-overflowing-a-container
436+
*/
437+
min-width: 0;
438+
}
439+
440+
.tab-osd .switchable-field-flex .switchable-field-description .osd-variant {
441+
margin-top: 5px;
442+
}
443+
426444
.spacer_box_title span {
427445
font-size: 11px;
428446
font-weight: normal;
@@ -455,7 +473,7 @@ button {
455473

456474
.tab-osd .preview {
457475
width: 360px;
458-
float: left;
476+
float: left;
459477
position: sticky;
460478
top: 0;
461479
margin-left: calc((100% - 360px) / 3);

src/js/tabs/osd.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,7 +2877,7 @@ TABS.osd.initialize = function(callback) {
28772877
enabledCount++;
28782878
}
28792879

2880-
const $field = $(`<div class="switchable-field field-${field.index}"></div>`);
2880+
const $field = $(`<div class="switchable-field switchable-field-flex field-${field.index}"></div>`);
28812881
let desc = null;
28822882
if (field.desc && field.desc.length) {
28832883
desc = i18n.getMessage(field.desc);
@@ -2917,7 +2917,9 @@ TABS.osd.initialize = function(callback) {
29172917
}
29182918

29192919
const finalFieldName = titleizeField(field);
2920-
$field.append(`<label for="${field.name}" class="char-label">${finalFieldName}</label>`);
2920+
const $labelAndVariant = $('<div class="switchable-field-description"></div>');
2921+
$labelAndVariant.append(`<label for="${field.name}" class="char-label">${finalFieldName}</label>`);
2922+
29212923

29222924

29232925
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44) && field.variants && field.variants.length > 0) {
@@ -2941,7 +2943,7 @@ TABS.osd.initialize = function(callback) {
29412943

29422944
selectVariant.val(field.variant);
29432945

2944-
$field.append(selectVariant);
2946+
$labelAndVariant.append(selectVariant);
29452947
}
29462948

29472949
if (field.positionable && field.isVisible[OSD.getCurrentPreviewProfile()]) {
@@ -2961,6 +2963,7 @@ TABS.osd.initialize = function(callback) {
29612963
);
29622964
}
29632965

2966+
$field.append($labelAndVariant);
29642967
// Insert in alphabetical order, with unknown fields at the end
29652968
$field.name = field.name;
29662969
insertOrdered($displayFields, $field);

0 commit comments

Comments
 (0)