Skip to content

Commit abdcbc6

Browse files
authored
Merge pull request #2920 from benlumley/improve-osd-elements-rendering
OSD Tab - Improve the way osd elements picker + timer section render/wrap
2 parents 87eec42 + 6120a07 commit abdcbc6

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

src/css/tabs/osd.css

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,28 @@ 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: row;
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+
justify-content: space-between;
439+
width: 100%;
440+
flex-wrap: wrap;
441+
}
442+
443+
444+
.tab-osd .switchable-field-flex .switchable-field-description .osd-variant {
445+
flex-grow: 2;
446+
}
447+
426448
.spacer_box_title span {
427449
font-size: 11px;
428450
font-weight: normal;
@@ -455,7 +477,7 @@ button {
455477

456478
.tab-osd .preview {
457479
width: 360px;
458-
float: left;
480+
float: left;
459481
position: sticky;
460482
top: 0;
461483
margin-left: calc((100% - 360px) / 3);
@@ -506,9 +528,20 @@ button {
506528
display: inline !important;
507529
}
508530

531+
.timers-container .timer-detail {
532+
padding-left: 15px;
533+
padding-top: 3px;
534+
padding-bottom: 3px;
535+
}
536+
509537
.timers-container label {
510-
margin-left: 15px !important;
511538
margin-right: 5px !important;
539+
display: inline-block;
540+
width: 80px;
541+
}
542+
543+
.timers-container input, .timers-container select {
544+
width: 150px;
512545
}
513546

514547
@media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) {

src/js/tabs/osd.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,7 @@ TABS.osd.initialize = function(callback) {
26402640
timerTableRow.append(`<td>${tim.index + 1}</td>`);
26412641

26422642
// Source
2643-
const sourceTimerTableData = $('<td class="osd_tip"></td>');
2643+
const sourceTimerTableData = $('<td class="timer-detail osd_tip"></td>');
26442644
sourceTimerTableData.attr('title', i18n.getMessage('osdTimerSourceTooltip'));
26452645
sourceTimerTableData.append(`<label for="timerSource_${tim.index}" class="char-label">${i18n.getMessage('osdTimerSource')}</label>`);
26462646
const src = $(`<select class="timer-option" id="timerSource_${tim.index}"></select>`);
@@ -2663,7 +2663,7 @@ TABS.osd.initialize = function(callback) {
26632663
// Precision
26642664
timerTableRow = $('<tr />');
26652665
timerTable.append(timerTableRow);
2666-
const precisionTimerTableData = $('<td class="osd_tip"></td>');
2666+
const precisionTimerTableData = $('<td class="timer-detail osd_tip"></td>');
26672667
precisionTimerTableData.attr('title', i18n.getMessage('osdTimerPrecisionTooltip'));
26682668
precisionTimerTableData.append(`<label for="timerPrec_${tim.index}" class="char-label">${i18n.getMessage('osdTimerPrecision')}</label>`);
26692669
const precision = $(`<select class="timer-option osd_tip" id="timerPrec_${tim.index}"></select>`);
@@ -2687,7 +2687,7 @@ TABS.osd.initialize = function(callback) {
26872687
// Alarm
26882688
timerTableRow = $('<tr />');
26892689
timerTable.append(timerTableRow);
2690-
const alarmTimerTableData = $('<td class="osd_tip"></td>');
2690+
const alarmTimerTableData = $('<td class="timer-detail osd_tip"></td>');
26912691
alarmTimerTableData.attr('title', i18n.getMessage('osdTimerAlarmTooltip'));
26922692
alarmTimerTableData.append(`<label for="timerAlarm_${tim.index}" class="char-label">${i18n.getMessage('osdTimerAlarm')}</label>`);
26932693
const alarm = $(`<input class="timer-option osd_tip" name="alarm" type="number" min=0 id="timerAlarm_${tim.index}"/>`);
@@ -2881,7 +2881,7 @@ TABS.osd.initialize = function(callback) {
28812881
enabledCount++;
28822882
}
28832883

2884-
const $field = $(`<div class="switchable-field field-${field.index}"></div>`);
2884+
const $field = $(`<div class="switchable-field switchable-field-flex field-${field.index}"></div>`);
28852885
let desc = null;
28862886
if (field.desc && field.desc.length) {
28872887
desc = i18n.getMessage(field.desc);
@@ -2921,7 +2921,9 @@ TABS.osd.initialize = function(callback) {
29212921
}
29222922

29232923
const finalFieldName = titleizeField(field);
2924-
$field.append(`<label for="${field.name}" class="char-label">${finalFieldName}</label>`);
2924+
const $labelAndVariant = $('<div class="switchable-field-description"></div>');
2925+
$labelAndVariant.append(`<label for="${field.name}" class="char-label">${finalFieldName}</label>`);
2926+
29252927

29262928

29272929
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44) && field.variants && field.variants.length > 0) {
@@ -2945,7 +2947,7 @@ TABS.osd.initialize = function(callback) {
29452947

29462948
selectVariant.val(field.variant);
29472949

2948-
$field.append(selectVariant);
2950+
$labelAndVariant.append(selectVariant);
29492951
}
29502952

29512953
if (field.positionable && field.isVisible[OSD.getCurrentPreviewProfile()]) {
@@ -2965,6 +2967,7 @@ TABS.osd.initialize = function(callback) {
29652967
);
29662968
}
29672969

2970+
$field.append($labelAndVariant);
29682971
// Insert in alphabetical order, with unknown fields at the end
29692972
$field.name = field.name;
29702973
insertOrdered($displayFields, $field);

0 commit comments

Comments
 (0)