diff options
author | Paweł Spychalski <pspychalski@gmail.com> | 2022-08-14 12:03:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-14 12:03:24 +0300 |
commit | 64f81158c05ad3a3d12961a9ddc81de3ec59616a (patch) | |
tree | 9355c7916634b460a69c4091e05c289177fdc543 | |
parent | 88db2005f3fa81873c0addae5892f5084d8c9a97 (diff) | |
parent | daa70fc4b1c3b46b4886f299623eaf74477c9b1f (diff) |
Merge pull request #1603 from iNavFlight/MrD_Fix-number-of-logic-conditions-visible
Fixed and enhanced LC display
-rw-r--r-- | js/fc.js | 2 | ||||
-rw-r--r-- | js/gui.js | 15 | ||||
-rw-r--r-- | js/logicCondition.js | 3 | ||||
-rw-r--r-- | js/logicConditionsCollection.js | 4 | ||||
-rw-r--r-- | main.css | 4 | ||||
-rw-r--r-- | tabs/mixer.js | 1 | ||||
-rw-r--r-- | tabs/programming.js | 1 |
7 files changed, 25 insertions, 5 deletions
@@ -1249,7 +1249,7 @@ var FC = { 4: { name: "Logic Condition", type: "range", - range: [0, 31], + range: [0, (LOGIC_CONDITIONS.getMaxLogicConditionCount()-1)], default: 0 }, 5: { @@ -300,16 +300,27 @@ GUI_control.prototype.renderOperandValue = function ($container, operandMetadata * @param {function} onChange * @param {boolean} withAlways */ -GUI_control.prototype.renderLogicConditionSelect = function ($container, logicConditions, current, onChange, withAlways) { +GUI_control.prototype.renderLogicConditionSelect = function ($container, logicConditions, current, onChange, withAlways, onlyEnabled) { let $select = $container.append('<select class="mix-rule-condition">').find("select"), lcCount = logicConditions.getCount(); + option = ""; 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>'); + if (!onlyEnabled || i === current || (logicConditions.isEnabled(i))) { + option = '<option'; + + if (i === current && !logicConditions.isEnabled(i)) { + option+= ' class="lc_disabled"'; + } + + option+= ' value="' + i + '">Logic Condition ' + i + ' </option>'; + + $select.append(option); + } } $select.val(current).change(onChange); diff --git a/js/logicCondition.js b/js/logicCondition.js index e5a5de3e..8409476b 100644 --- a/js/logicCondition.js +++ b/js/logicCondition.js @@ -218,9 +218,10 @@ let LogicCondition = function (enabled, activatorId, operation, operandAType, op if (self.getEnabled()) { GUI.renderLogicConditionSelect( $e, - LOGIC_CONDITIONS, + LOGIC_CONDITIONS, self.getActivatorId, self.onActivatorChange, + true, true ); } else { diff --git a/js/logicConditionsCollection.js b/js/logicConditionsCollection.js index 84ccc8ce..9412362c 100644 --- a/js/logicConditionsCollection.js +++ b/js/logicConditionsCollection.js @@ -28,6 +28,10 @@ let LogicConditionsCollection = function () { return data.length }; + self.isEnabled = function (lcID) { + return data[lcID].getEnabled(); + } + self.open = function () { self.render(); $container.show(); @@ -2010,6 +2010,10 @@ select { padding: 1px; } +.lc_disabled { + color: #aaa; +} + .ic_osd { background-image: url("../images/icons/icon_osd.svg"); background-position-y: 4px; diff --git a/tabs/mixer.js b/tabs/mixer.js index 85462cec..660dc6b8 100644 --- a/tabs/mixer.js +++ b/tabs/mixer.js @@ -295,6 +295,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) { function () { servoRule.setConditionId($(this).val()); }, + true, true ); diff --git a/tabs/programming.js b/tabs/programming.js index 6c22c85b..8114b913 100644 --- a/tabs/programming.js +++ b/tabs/programming.js @@ -40,7 +40,6 @@ TABS.programming.initialize = function (callback, scrollPosition) { } function processHtml() { - LOGIC_CONDITIONS.init($('#subtab-lc')); LOGIC_CONDITIONS.render(); |