mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-26 01:35:23 +03:00
Updated mode re-ordering to fix highlighting
This commit is contained in:
parent
f51660ecf8
commit
07af49856e
1 changed files with 14 additions and 8 deletions
|
@ -1,5 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var ORIG_AUX_CONFIG_IDS = [];
|
||||||
|
|
||||||
TABS.auxiliary = {};
|
TABS.auxiliary = {};
|
||||||
|
|
||||||
TABS.auxiliary.initialize = function (callback) {
|
TABS.auxiliary.initialize = function (callback) {
|
||||||
|
@ -31,7 +33,9 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
sort_modes_for_display();
|
sort_modes_for_display();
|
||||||
GUI.load("./tabs/auxiliary.html", process_html);
|
GUI.load("./tabs/auxiliary.html", process_html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges);
|
||||||
|
|
||||||
function sort_modes_for_display() {
|
function sort_modes_for_display() {
|
||||||
// This array defines the order that the modes are displayed in the configurator modes page
|
// This array defines the order that the modes are displayed in the configurator modes page
|
||||||
configuratorBoxOrder = [
|
configuratorBoxOrder = [
|
||||||
|
@ -66,7 +70,9 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
for(j=0; j<tmpAUX_CONFIG.length; j++) {
|
for(j=0; j<tmpAUX_CONFIG.length; j++) {
|
||||||
if (configuratorBoxOrder[i] === tmpAUX_CONFIG[j]) {
|
if (configuratorBoxOrder[i] === tmpAUX_CONFIG[j]) {
|
||||||
AUX_CONFIG[sortedID] = tmpAUX_CONFIG[j];
|
AUX_CONFIG[sortedID] = tmpAUX_CONFIG[j];
|
||||||
AUX_CONFIG_IDS[sortedID++] = tmpAUX_CONFIG_IDS[j];
|
AUX_CONFIG_IDS[sortedID] = tmpAUX_CONFIG_IDS[j];
|
||||||
|
ORIG_AUX_CONFIG_IDS[sortedID++] = j;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,14 +91,13 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
AUX_CONFIG[sortedID] = tmpAUX_CONFIG[i];
|
AUX_CONFIG[sortedID] = tmpAUX_CONFIG[i];
|
||||||
AUX_CONFIG_IDS[sortedID++] = tmpAUX_CONFIG_IDS[i];
|
AUX_CONFIG_IDS[sortedID] = tmpAUX_CONFIG_IDS[i];
|
||||||
|
ORIG_AUX_CONFIG_IDS[sortedID++] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false, get_mode_ranges);
|
|
||||||
|
|
||||||
function createMode(modeIndex, modeId) {
|
function createMode(modeIndex, modeId) {
|
||||||
var modeTemplate = $('#tab-auxiliary-templates .mode');
|
var modeTemplate = $('#tab-auxiliary-templates .mode');
|
||||||
var newMode = modeTemplate.clone();
|
var newMode = modeTemplate.clone();
|
||||||
|
@ -105,6 +110,7 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
|
|
||||||
$(newMode).data('index', modeIndex);
|
$(newMode).data('index', modeIndex);
|
||||||
$(newMode).data('id', modeId);
|
$(newMode).data('id', modeId);
|
||||||
|
$(newMode).data('origId', ORIG_AUX_CONFIG_IDS[modeIndex]);
|
||||||
|
|
||||||
$(newMode).find('.name').data('modeElement', newMode);
|
$(newMode).find('.name').data('modeElement', newMode);
|
||||||
$(newMode).find('a.addRange').data('modeElement', newMode);
|
$(newMode).find('a.addRange').data('modeElement', newMode);
|
||||||
|
@ -345,10 +351,10 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FC.isModeBitSet(i)) {
|
if (FC.isModeBitSet(modeElement.data('origId'))) {
|
||||||
$('.mode .name').eq(i).data('modeElement').addClass('on').removeClass('off');
|
$('.mode .name').eq(modeElement.data('index')).data('modeElement').addClass('on').removeClass('off');
|
||||||
} else {
|
} else {
|
||||||
$('.mode .name').eq(i).data('modeElement').removeClass('on').addClass('off');
|
$('.mode .name').eq(modeElement.data('index')).data('modeElement').removeClass('on').addClass('off');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue