1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-23 16:25:22 +03:00

Fix some button related bugs and add some missing styles

This commit is contained in:
ASDosjani 2022-09-09 14:01:31 +02:00
parent 7507fc0b42
commit d1ca0e446e
2 changed files with 42 additions and 24 deletions

View file

@ -237,6 +237,12 @@
} }
.modifiers { .modifiers {
display: inline-block; display: inline-block;
.auxSelect {
border: 1px solid var(--subtleAccent);
border-radius: 3px;
background: var(--boxBackground);
color: var(--defaultText);
}
} }
.colorDefineSliders { .colorDefineSliders {
display: inline-block; display: inline-block;
@ -358,6 +364,12 @@
button.btnOn { button.btnOn {
border-color: #000; border-color: #000;
} }
.modeSelect {
border: 1px solid var(--subtleAccent);
border-radius: 3px;
background: var(--boxBackground);
color: var(--defaultText);
}
} }
.indicators { .indicators {
position: relative; position: relative;

View file

@ -400,7 +400,7 @@ led_strip.initialize = function (callback, scrollPosition) {
if (feature_o.is(':checked') !== newVal) { if (feature_o.is(':checked') !== newVal) {
feature_o.prop('checked', newVal); feature_o.prop('checked', newVal);
feature_o.change(); feature_o.trigger('change');
} }
}); });
@ -503,10 +503,28 @@ led_strip.initialize = function (callback, scrollPosition) {
} }
// UI: check-box toggle // UI: check-box toggle
$('.checkbox').change(function(e) { $('.checkbox').on('change', function(e) {
if (e.originalEvent) { if (e.originalEvent) {
// user-triggered event // user-triggered event
const that = $(this).find('input'); const that = $(this).find('input');
//disable Blink always or Larson scanner, both functions are not working properly at the same time
if (that.is('.function-o')) {
const blink = $('.checkbox .function-b');
if (blink.is(':checked')) {
blink.prop('checked', false);
blink.trigger('change');
toggleSwitch(blink, 'b');
}
} else if (that.is('.function-b')) {
const larson = $('.checkbox .function-o');
if ($('.checkbox .function-o').is(':checked')) {
larson.prop('checked', false);
larson.trigger('change');
toggleSwitch(larson, 'o');
}
}
if ($('.ui-selected').length > 0) { if ($('.ui-selected').length > 0) {
TABS.led_strip.overlays.forEach(function(letter) { TABS.led_strip.overlays.forEach(function(letter) {
@ -519,11 +537,11 @@ led_strip.initialize = function (callback, scrollPosition) {
if (ret) { if (ret) {
if (letter == 'b' && cbn.is(':checked')) { if (letter == 'b' && cbn.is(':checked')) {
cbn.prop('checked', false); cbn.prop('checked', false);
cbn.change(); cbn.trigger('change');
toggleSwitch(cbn, 'n'); toggleSwitch(cbn, 'n');
} else if (letter == 'n' && cbb.is(':checked')) { } else if (letter == 'n' && cbb.is(':checked')) {
cbb.prop('checked', false); cbb.prop('checked', false);
cbb.change(); cbb.trigger('change');
toggleSwitch(cbb, 'b'); toggleSwitch(cbb, 'b');
} }
} }
@ -577,8 +595,7 @@ led_strip.initialize = function (callback, scrollPosition) {
}); });
$('a.save').click(function () { $('a.save').on('click', function () {
mspHelper.sendLedStripConfig(send_led_strip_colors); mspHelper.sendLedStripConfig(send_led_strip_colors);
function send_led_strip_colors() { function send_led_strip_colors() {
@ -848,26 +865,15 @@ led_strip.initialize = function (callback, scrollPosition) {
// set color modifiers (check-boxes) visibility // set color modifiers (check-boxes) visibility
$('.overlays').hide(); $('.overlays').toggle(areOverlaysActive(activeFunction));
$('.modifiers').hide();
$('.blinkers').hide();
$('.warningOverlay').hide();
$('.vtxOverlay').hide();
if (areOverlaysActive(activeFunction)) $('.modifiers').toggle(areModifiersActive(activeFunction));
$('.overlays').show();
if (areModifiersActive(activeFunction)) $('.blinkers').toggle(areBlinkersActive(activeFunction));
$('.modifiers').show();
if (areBlinkersActive(activeFunction)) $('.warningOverlay').toggle(isWarningActive(activeFunction));
$('.blinkers').show();
if (isWarningActive(activeFunction)) $('.vtxOverlay').toggle(isVtxActive(activeFunction));
$('.warningOverlay').show();
if (isVtxActive(activeFunction))
$('.vtxOverlay').show();
// set directions visibility // set directions visibility
if (semver.lt(FC.CONFIG.apiVersion, "1.20.0")) { if (semver.lt(FC.CONFIG.apiVersion, "1.20.0")) {
@ -991,7 +997,7 @@ led_strip.initialize = function (callback, scrollPosition) {
function unselectOverlay(func, overlay) { function unselectOverlay(func, overlay) {
$(`input.function-${overlay}`).prop('checked', false); $(`input.function-${overlay}`).prop('checked', false);
$(`input.function-${overlay}`).change(); $(`input.function-${overlay}`).trigger('change');
$('.ui-selected').each(function() { $('.ui-selected').each(function() {
if (func === '' || $(this).is(functionTag + func)) { if (func === '' || $(this).is(functionTag + func)) {
$(this).removeClass(`function-${overlay}`); $(this).removeClass(`function-${overlay}`);
@ -1121,7 +1127,7 @@ led_strip.initialize = function (callback, scrollPosition) {
return mc.color; return mc.color;
} }
} }
return ""; return 3; //index of Throttle, use as default
} }
function setModeColor(mode, dir, color) { function setModeColor(mode, dir, color) {