drum-machine add notification that selectionMenu is focused

This commit is contained in:
Trent Palmer 2020-05-29 06:46:24 -07:00
parent 6d81e5070e
commit c17a49fbbe
3 changed files with 21 additions and 3 deletions

View File

@ -10,6 +10,6 @@
### TODOS ### TODOS
* add tip for scrolling selectionMenuItems
* make sure metronome continues on volume, sound, or metronome BPM change * make sure metronome continues on volume, sound, or metronome BPM change
* add additional metronome speed values * add additional metronome speed values
* update bpm in drumpad when metronome playing

View File

@ -65,6 +65,10 @@ body {
margin-top: -10px; margin-top: -10px;
} }
#menuScrollTip {
padding-top: 20px;
}
#display-middle { #display-middle {
flex-basis: 62%; flex-basis: 62%;
width: 100%; width: 100%;
@ -348,7 +352,7 @@ i.fa-volume-up {
margin-right: auto; margin-right: auto;
} }
#select-volume, #display-middle-right-f, #display-middle-right-g, #volumeTip { #select-volume, #display-middle-right-f, #display-middle-right-g, #volumeTip, #menuScrollTip {
display: none; display: none;
} }
@ -437,7 +441,7 @@ i.fa-volume-up {
margin-right: auto; margin-right: auto;
} }
#select-volume, #display-middle-right-f, #display-middle-right-g, #volumeTip { #select-volume, #display-middle-right-f, #display-middle-right-g, #volumeTip, #menuScrollTip {
display: none; display: none;
} }

View File

@ -33,6 +33,7 @@ const makeMetronomeSelection = (selection) => {
metronomeMenuDisplayed = true; metronomeMenuDisplayed = true;
showKeyMetronomeSelectionMenu(); showKeyMetronomeSelectionMenu();
$('#metronomeSelectionMenu').attr("tabindex",0).focus(); $('#metronomeSelectionMenu').attr("tabindex",0).focus();
$('#display-top').append('<p id="menuScrollTip">scroll menu with arrow keys or PgUpDn, "esc" key to go back</p>');
} else if (padsArray.includes(selection)) { } else if (padsArray.includes(selection)) {
padSelectingFor = selection; padSelectingFor = selection;
showMetronomeMenu(); showMetronomeMenu();
@ -41,18 +42,21 @@ const makeMetronomeSelection = (selection) => {
sessionStorage.setItem(padSelectingFor + 'isMetronome',false); sessionStorage.setItem(padSelectingFor + 'isMetronome',false);
metronomeMenuDisplayed = false; metronomeMenuDisplayed = false;
$('#display-middle-left-b').html((drumPadGrid)); $('#display-middle-left-b').html((drumPadGrid));
$('#menuScrollTip').remove();
makeAudioControl(padSelectingFor); makeAudioControl(padSelectingFor);
} else if (selection.includes('bpm')) { } else if (selection.includes('bpm')) {
sessionStorage.setItem(padSelectingFor + 'metronomeTempo',selection); sessionStorage.setItem(padSelectingFor + 'metronomeTempo',selection);
sessionStorage.setItem(padSelectingFor + 'isMetronome',true); sessionStorage.setItem(padSelectingFor + 'isMetronome',true);
metronomeMenuDisplayed = false; metronomeMenuDisplayed = false;
$('#display-middle-left-b').html((drumPadGrid)); $('#display-middle-left-b').html((drumPadGrid));
$('#menuScrollTip').remove();
makeAudioControl(padSelectingFor); makeAudioControl(padSelectingFor);
makeMetronomeIcons(padSelectingFor); makeMetronomeIcons(padSelectingFor);
} else if (selection === '( cancel -- back )') { } else if (selection === '( cancel -- back )') {
if (padSelectingFor === '') { if (padSelectingFor === '') {
metronomeMenuDisplayed = false; metronomeMenuDisplayed = false;
$('#display-middle-left-b').html((drumPadGrid)); $('#display-middle-left-b').html((drumPadGrid));
$('#menuScrollTip').remove();
} else { } else {
padSelectingFor = ''; padSelectingFor = '';
showKeyMetronomeSelectionMenu(); showKeyMetronomeSelectionMenu();
@ -117,6 +121,7 @@ const makeVolumeSelection = (selection) => {
volumeMenuDisplayed = true; volumeMenuDisplayed = true;
showKeyVolumeSelectionMenu(); showKeyVolumeSelectionMenu();
$('#volumeSelectionMenu').attr("tabindex",0).focus(); $('#volumeSelectionMenu').attr("tabindex",0).focus();
$('#display-top').append('<p id="menuScrollTip">scroll menu with arrow keys or PgUpDn, "esc" key to go back</p>');
} else if (padsArray.includes(selection)) { } else if (padsArray.includes(selection)) {
padSelectingFor = selection; padSelectingFor = selection;
showVolumeMenu(); showVolumeMenu();
@ -125,10 +130,12 @@ const makeVolumeSelection = (selection) => {
sessionStorage.setItem((padSelectingFor + 'volume'),selection); sessionStorage.setItem((padSelectingFor + 'volume'),selection);
volumeMenuDisplayed = false; volumeMenuDisplayed = false;
$('#display-middle-left-b').html((drumPadGrid)); $('#display-middle-left-b').html((drumPadGrid));
$('#menuScrollTip').remove();
} else if (selection === '( cancel -- back )') { } else if (selection === '( cancel -- back )') {
if (padSelectingFor === '') { if (padSelectingFor === '') {
volumeMenuDisplayed = false; volumeMenuDisplayed = false;
$('#display-middle-left-b').html((drumPadGrid)); $('#display-middle-left-b').html((drumPadGrid));
$('#menuScrollTip').remove();
} else { } else {
padSelectingFor = ''; padSelectingFor = '';
showKeyVolumeSelectionMenu(); showKeyVolumeSelectionMenu();
@ -192,13 +199,16 @@ const makeSelection = (selection) => {
menuDisplayed = true; menuDisplayed = true;
showKeySelectionMenu(); showKeySelectionMenu();
$('#selectionMenu').attr("tabindex",0).focus(); $('#selectionMenu').attr("tabindex",0).focus();
$('#display-top').append('<p id="menuScrollTip">scroll menu with arrow keys or PgUpDn, "esc" key to go back</p>');
} else if (padsArray.includes(selection)) { } else if (padsArray.includes(selection)) {
padSelectingFor = selection; padSelectingFor = selection;
showFirstDirMenu(); showFirstDirMenu();
$('#menuScrollTip').remove();
} else if (selection.substring(selection.length - 4) !== '.wav' && selection !== '( cancel -- back )') { } else if (selection.substring(selection.length - 4) !== '.wav' && selection !== '( cancel -- back )') {
fileStringArray.push(selection); fileStringArray.push(selection);
if (fileStringArray.length === 1) { if (fileStringArray.length === 1) {
showSecondDirMenu(); showSecondDirMenu();
$('#display-top').append('<p id="menuScrollTip">scroll menu with arrow keys or PgUpDn, "esc" key to go back</p>');
$('#selectionMenu').attr("tabindex",0).focus(); $('#selectionMenu').attr("tabindex",0).focus();
} else if (fileStringArray.length === 2) { } else if (fileStringArray.length === 2) {
showThirdDirMenu(); showThirdDirMenu();
@ -212,20 +222,24 @@ const makeSelection = (selection) => {
sessionStorage.setItem(padSelectingFor,fileStringArray.join('/')); sessionStorage.setItem(padSelectingFor,fileStringArray.join('/'));
menuDisplayed = false; menuDisplayed = false;
$('#display-middle-left-b').html((drumPadGrid)); $('#display-middle-left-b').html((drumPadGrid));
$('#menuScrollTip').remove();
makeAudioControl(padSelectingFor); makeAudioControl(padSelectingFor);
} else if (selection === '( cancel -- back )') { } else if (selection === '( cancel -- back )') {
if (fileStringArray.length === 0) { if (fileStringArray.length === 0) {
if (padSelectingFor === '') { if (padSelectingFor === '') {
menuDisplayed = false; menuDisplayed = false;
$('#display-middle-left-b').html((drumPadGrid)); $('#display-middle-left-b').html((drumPadGrid));
$('#menuScrollTip').remove();
} else { } else {
padSelectingFor = ''; padSelectingFor = '';
showKeySelectionMenu(); showKeySelectionMenu();
$('#selectionMenu').attr("tabindex",0).focus(); $('#selectionMenu').attr("tabindex",0).focus();
$('#display-top').append('<p id="menuScrollTip">scroll menu with arrow keys or PgUpDn, "esc" key to go back</p>');
} }
} else if (fileStringArray.length === 1) { } else if (fileStringArray.length === 1) {
fileStringArray = []; fileStringArray = [];
showFirstDirMenu(); showFirstDirMenu();
$('#menuScrollTip').remove();
} else if (fileStringArray.length === 2) { } else if (fileStringArray.length === 2) {
fileStringArray.pop(); fileStringArray.pop();
showSecondDirMenu(); showSecondDirMenu();