Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some missing style and minor bugfix #2996

Merged
merged 1 commit into from Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/css/tabs/led_strip.less
Expand Up @@ -237,6 +237,12 @@
}
.modifiers {
display: inline-block;
.auxSelect {
border: 1px solid var(--subtleAccent);
border-radius: 3px;
background: var(--boxBackground);
color: var(--defaultText);
}
}
.colorDefineSliders {
display: inline-block;
Expand Down Expand Up @@ -358,6 +364,12 @@
button.btnOn {
border-color: #000;
}
.modeSelect {
border: 1px solid var(--subtleAccent);
border-radius: 3px;
background: var(--boxBackground);
color: var(--defaultText);
}
}
.indicators {
position: relative;
Expand Down
54 changes: 30 additions & 24 deletions src/js/tabs/led_strip.js
Expand Up @@ -400,7 +400,7 @@ led_strip.initialize = function (callback, scrollPosition) {

if (feature_o.is(':checked') !== newVal) {
feature_o.prop('checked', newVal);
feature_o.change();
feature_o.trigger('change');
}
});

Expand Down Expand Up @@ -503,10 +503,28 @@ led_strip.initialize = function (callback, scrollPosition) {
}

// UI: check-box toggle
$('.checkbox').change(function(e) {
$('.checkbox').on('change', function(e) {
if (e.originalEvent) {
// user-triggered event
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) {

TABS.led_strip.overlays.forEach(function(letter) {
Expand All @@ -519,11 +537,11 @@ led_strip.initialize = function (callback, scrollPosition) {
if (ret) {
if (letter == 'b' && cbn.is(':checked')) {
cbn.prop('checked', false);
cbn.change();
cbn.trigger('change');
toggleSwitch(cbn, 'n');
} else if (letter == 'n' && cbb.is(':checked')) {
cbb.prop('checked', false);
cbb.change();
cbb.trigger('change');
toggleSwitch(cbb, 'b');
}
}
Expand Down Expand Up @@ -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);

function send_led_strip_colors() {
Expand Down Expand Up @@ -848,26 +865,15 @@ led_strip.initialize = function (callback, scrollPosition) {


// set color modifiers (check-boxes) visibility
$('.overlays').hide();
$('.modifiers').hide();
$('.blinkers').hide();
$('.warningOverlay').hide();
$('.vtxOverlay').hide();
$('.overlays').toggle(areOverlaysActive(activeFunction));

if (areOverlaysActive(activeFunction))
$('.overlays').show();
$('.modifiers').toggle(areModifiersActive(activeFunction));

if (areModifiersActive(activeFunction))
$('.modifiers').show();
$('.blinkers').toggle(areBlinkersActive(activeFunction));

if (areBlinkersActive(activeFunction))
$('.blinkers').show();
$('.warningOverlay').toggle(isWarningActive(activeFunction));

if (isWarningActive(activeFunction))
$('.warningOverlay').show();

if (isVtxActive(activeFunction))
$('.vtxOverlay').show();
$('.vtxOverlay').toggle(isVtxActive(activeFunction));

// set directions visibility
if (semver.lt(FC.CONFIG.apiVersion, "1.20.0")) {
Expand Down Expand Up @@ -991,7 +997,7 @@ led_strip.initialize = function (callback, scrollPosition) {

function unselectOverlay(func, overlay) {
$(`input.function-${overlay}`).prop('checked', false);
$(`input.function-${overlay}`).change();
$(`input.function-${overlay}`).trigger('change');
$('.ui-selected').each(function() {
if (func === '' || $(this).is(functionTag + func)) {
$(this).removeClass(`function-${overlay}`);
Expand Down Expand Up @@ -1121,7 +1127,7 @@ led_strip.initialize = function (callback, scrollPosition) {
return mc.color;
}
}
return "";
return 3; //index of Throttle, use as default
}

function setModeColor(mode, dir, color) {
Expand Down