1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-24 16:55:22 +03:00

Unified LogicConditions selector

This commit is contained in:
Pawel Spychalski (DzikuVx) 2020-04-14 11:55:23 +02:00
parent dd551f5ecb
commit c005214a2b
3 changed files with 39 additions and 24 deletions

View file

@ -292,5 +292,27 @@ GUI_control.prototype.renderOperandValue = function ($container, operandMetadata
$container.find('.logic_element__operand--value').change(onChange);
};
/**
* @param {jQuery} $container
* @param {LogicConditionsCollection} logicConditions
* @param {int} current
* @param {function} onChange
* @param {boolean} withAlways
*/
GUI_control.prototype.renderLogicConditionSelect = function ($container, logicConditions, current, onChange, withAlways) {
let $select = $container.append('<select class="mix-rule-condition">').find("select"),
lcCount = logicConditions.getCount();
if (withAlways) {
$select.append('<option value="-1">Always</option>')
}
for (let i = 0; i < lcCount ; i++) {
$select.append('<option value="' + i + '">Logic Condition ' + i + ' </option>');
}
$select.val(current).change(onChange);
}
// initialize object into GUI variable
var GUI = new GUI_control();