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