Fix HSV tab in LED tab (Android App)

Fix code smells


Fix code smells
10.8-maintenance
WalcoFPV 2020-07-08 11:35:24 +02:00
parent c59f49d160
commit c143c0b083
1 changed files with 19 additions and 6 deletions

View File

@ -227,6 +227,8 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
updateColors(ip.eq(i).val(), i);
}
const colorDefineSliders = $('.colorDefineSliders');
// Color Buttons
$('.colors').on('click', 'button', function(e) {
var that = this;
@ -266,15 +268,26 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
});
$('.colors').on('dblclick', 'button', function() {
$('.colorDefineSliders').css('left', $(this).position().left - $('.colorDefineSliders').width() / 2 + $(this).width());
$('.colorDefineSliders').css('top', $(this).position().top + 26);
$('.colorDefineSliders').show();
const position = $(this).position();
const colorDefineSlidersWidth = colorDefineSliders.width();
const width = $(this).width();
const calc = $(this).offset().left + colorDefineSlidersWidth / 2 + width + 14;
if (calc > $(window).width()) {
colorDefineSliders.css('left', 'auto');
colorDefineSliders.css('right', 0);
} else {
colorDefineSliders.css('left', position.left - colorDefineSlidersWidth / 2 + width);
colorDefineSliders.css('right', 'auto');
}
colorDefineSliders.css('top', position.top + 26);
colorDefineSliders.show();
});
$('.colors').children().on({
mouseleave: function () {
if (!$('.colorDefineSliders').is(":hover"))
$('.colorDefineSliders').hide();
if (!colorDefineSliders.is(":hover")) {
colorDefineSliders.hide();
}
}
});
@ -585,7 +598,7 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
});
$('.colorDefineSliders').hide();
colorDefineSliders.hide();
applyFunctionToSelectedLeds();
drawColorBoxesInColorLedPoints();