Adding a 'Clear ALL' button on the LED Strip tab. Updating 'Clear' so
that it also clears the wire order. This makes it easier to change LED layouts without too much button clicking.10.3.x-maintenance
parent
822af2352e
commit
bb13699b48
|
@ -7,6 +7,7 @@
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="wires-remaining"><div></div>Remaining</div>
|
<div class="wires-remaining"><div></div>Remaining</div>
|
||||||
<button class="funcClear">Clear selected</button>
|
<button class="funcClear">Clear selected</button>
|
||||||
|
<button class="funcClearAll">Clear ALL</button>
|
||||||
|
|
||||||
<div class="section">LED Functions</div>
|
<div class="section">LED Functions</div>
|
||||||
<div class="functions">
|
<div class="functions">
|
||||||
|
|
|
@ -53,22 +53,43 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Clear Button
|
// Clear button
|
||||||
$('.funcClear').click(function() {
|
$('.funcClear').click(function() {
|
||||||
$('.gPoint').each(function() {
|
$('.gPoint').each(function() {
|
||||||
if ($(this).is('.ui-selected')) {
|
if ($(this).is('.ui-selected')) {
|
||||||
$(this).removeClass(function(index, theClass) {
|
removeFunctionsAndDirections(this);
|
||||||
theClass = theClass.replace(/(^|\s)+gPoint\s+/, '');
|
$(this).find('.wire').html('');
|
||||||
return theClass;
|
|
||||||
});
|
|
||||||
$(this).addClass('ui-selected');
|
|
||||||
updateBulkCmd();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.controls button').removeClass('btnOn');
|
$('.controls button').removeClass('btnOn');
|
||||||
|
updateBulkCmd();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Clear All button
|
||||||
|
$('.funcClearAll').click(function() {
|
||||||
|
$('.gPoint').each(function() {
|
||||||
|
removeFunctionsAndDirections(this);
|
||||||
|
});
|
||||||
|
$('.gPoint .wire').html('');
|
||||||
|
|
||||||
|
updateBulkCmd();
|
||||||
|
|
||||||
|
$('.controls button').removeClass('btnOn');
|
||||||
|
});
|
||||||
|
|
||||||
|
function removeFunctionsAndDirections(element) {
|
||||||
|
var classesToRemove = [];
|
||||||
|
|
||||||
|
TABS.led_strip.functions.forEach(function(letter) {
|
||||||
|
classesToRemove.push('function-' + letter);
|
||||||
|
});
|
||||||
|
TABS.led_strip.directions.forEach(function(letter) {
|
||||||
|
classesToRemove.push('dir-' + letter);
|
||||||
|
});
|
||||||
|
$(element).removeClass(classesToRemove.join(' '));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Directional Buttons
|
// Directional Buttons
|
||||||
$('.directions').on('click', 'button', function() {
|
$('.directions').on('click', 'button', function() {
|
||||||
|
|
Loading…
Reference in New Issue