mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 11:29:53 +03:00
Improve LC status indication
This commit is contained in:
parent
b193ea3aa6
commit
583e73ef22
6 changed files with 82 additions and 31 deletions
|
@ -64,6 +64,7 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
self.onEnabledChange = function (event) {
|
||||
let $cT = $(event.currentTarget);
|
||||
self.setEnabled(!!$cT.prop('checked'));
|
||||
self.renderStatus();
|
||||
};
|
||||
|
||||
self.getOperatorMetadata = function () {
|
||||
|
@ -84,6 +85,7 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
self.setOperandBValue(0);
|
||||
self.renderOperand(0);
|
||||
self.renderOperand(1);
|
||||
self.renderStatus();
|
||||
};
|
||||
|
||||
self.onOperatorTypeChange = function (event) {
|
||||
|
@ -158,19 +160,40 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
}
|
||||
}
|
||||
|
||||
self.renderStatus = function () {
|
||||
let $e = $row.find('.logic_cell__status'),
|
||||
displayType = FC.getLogicOperators()[self.getOperation()].output;
|
||||
|
||||
if (self.getEnabled() && displayType == "boolean") {
|
||||
$e.html('<div class="logic_cell__active_marker"></div>');
|
||||
} else if (self.getEnabled() && displayType == "raw") {
|
||||
$e.html('<div class="logic_cell__raw_value"></div>');
|
||||
} else {
|
||||
$e.html('');
|
||||
}
|
||||
}
|
||||
|
||||
self.update = function (index, value, $container) {
|
||||
if (typeof $row === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
let $marker = $row.find('.logic_cell__active_marker');
|
||||
|
||||
if (!!value) {
|
||||
$marker.addClass("logic_cell__active_marker--active");
|
||||
$marker.removeClass("logic_cell__active_marker--inactive");
|
||||
} else {
|
||||
$marker.removeClass("logic_cell__active_marker--active");
|
||||
$marker.addClass("logic_cell__active_marker--inactive");
|
||||
let displayType = FC.getLogicOperators()[self.getOperation()].output,
|
||||
$marker;
|
||||
|
||||
if (self.getEnabled() && displayType == "boolean") {
|
||||
$marker = $row.find('.logic_cell__active_marker');
|
||||
|
||||
if (!!value) {
|
||||
$marker.addClass("logic_cell__active_marker--active");
|
||||
$marker.removeClass("logic_cell__active_marker--inactive");
|
||||
} else {
|
||||
$marker.removeClass("logic_cell__active_marker--active");
|
||||
$marker.addClass("logic_cell__active_marker--inactive");
|
||||
}
|
||||
} else if (self.getEnabled() && displayType == "raw") {
|
||||
$marker = $row.find('.logic_cell__raw_value');
|
||||
$marker.html(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +205,8 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
<td class="logic_cell__operation"></td>\
|
||||
<td class="logic_cell__operandA"></td>\
|
||||
<td class="logic_cell__operandB"></td>\
|
||||
<td class="logic_cell__flags"><div class="logic_cell__active_marker"></div></td>\
|
||||
<td class="logic_cell__flags"></div></td>\
|
||||
<td class="logic_cell__status"></td>\
|
||||
</tr>\
|
||||
');
|
||||
|
||||
|
@ -214,6 +238,7 @@ let LogicCondition = function (enabled, operation, operandAType, operandAValue,
|
|||
|
||||
self.renderOperand(0);
|
||||
self.renderOperand(1);
|
||||
self.renderStatus();
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue