From 921a462081187a4758a89f8ca1191792cc325a81 Mon Sep 17 00:00:00 2001 From: Ray Morris Date: Fri, 29 Nov 2024 00:31:18 -0600 Subject: [PATCH] Don't show motor numbers for non-quad, do show onChange --- src/css/tabs/motors.css | 1 + tabs/mixer.js | 6 +++--- tabs/outputs.js | 16 +++++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/css/tabs/motors.css b/src/css/tabs/motors.css index 5d2f00b36..3802d31c1 100644 --- a/src/css/tabs/motors.css +++ b/src/css/tabs/motors.css @@ -472,6 +472,7 @@ .tab-motors .motorNumber { position: absolute; font-size: 1.4em; + visibility: hidden; } .tab-motors .mixer-preview-image-numbers { diff --git a/tabs/mixer.js b/tabs/mixer.js index 6e6c83f07..18ec6d8d5 100644 --- a/tabs/mixer.js +++ b/tabs/mixer.js @@ -476,6 +476,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) { $("#motorNumber"+index).css("left", left_px + "px"); $("#motorNumber"+index).css("top", top_px + "px"); $("#motorNumber"+index).removeClass("is-hidden"); + $("#motorNumber"+index).css("visibility", "visible"); } } } @@ -544,7 +545,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) { } } - labelMotorNumbers(); + labelMotorNumbers(); i18n.localize();; } @@ -610,7 +611,6 @@ TABS.mixer.initialize = function (callback, scrollPosition) { } } - return (errorCount == 0); } @@ -661,7 +661,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) { const path = './resources/motor_order/' + currentMixerPreset.image + (isReversed ? "_reverse" : "") + '.svg'; $('.mixerPreview img').attr('src', path); - + // labelMotorNumbers(); renderServoOutputImage(); }; diff --git a/tabs/outputs.js b/tabs/outputs.js index c7f259445..68b95811f 100644 --- a/tabs/outputs.js +++ b/tabs/outputs.js @@ -257,6 +257,7 @@ TABS.outputs.initialize = function (callback) { const path = './resources/motor_order/' + mixer.getById(val).image + (isReversed ? "_reverse" : "") + '.svg'; $('.mixerPreview img').attr('src', path); + labelMotorNumbers(); } function process_servos() { @@ -501,8 +502,6 @@ TABS.outputs.initialize = function (callback) { $motorSliders.append('
'); $motorValues.append('
  • '); - labelMotorNumbers(); - for (let i = 0; i < FC.SERVO_RULES.getServoCount(); i++) { let opacity = ""; @@ -720,6 +719,12 @@ TABS.outputs.initialize = function (callback) { } function labelMotorNumbers() { + + if (mixer.getById(FC.MIXER_CONFIG.appliedMixerPreset).image != 'quad_x') { + return; + } + + let index = 0; var rules = FC.MOTOR_RULES.get(); @@ -728,13 +733,6 @@ TABS.outputs.initialize = function (callback) { const rule = rules[i]; index++; - /* - if (currentMixerPreset.image != 'quad_x') { - $("#motorNumber"+index).css("visibility", "hidden"); - continue; - } - */ - let top_px = 30; let left_px = 28; if (rule.getRoll() < -0.5) {