better click handling

This commit is contained in:
jrkb 2023-10-10 13:28:40 +02:00
parent 523eb8c7f8
commit 62f03862d6

View file

@ -361,12 +361,24 @@ const Audio = function(tp, record) {
mappingOptions.max_in = (bb.height - min_y) * y_factor; mappingOptions.max_in = (bb.height - min_y) * y_factor;
} }
}); });
fft_Dom.addEventListener('mouseup', (e) => { const unset = (e) => {
setFrequency = false; setFrequency = false;
};
const unsetFromOutside = (e) => {
document.removeEventListener('mouseup', unsetFromOutside);
unset(e);
};
fft_Dom.addEventListener('mouseup', unset);
fft_Dom.addEventListener('mouseleave', (e) => {
if (setFrequency) {
document.addEventListener('mouseup', unsetFromOutside);
}
});
fft_Dom.addEventListener('mouseenter', (e) => {
if (setFrequency) {
document.removeEventListener('mouseup', unsetFromOutside);
}
}); });
//fft_Dom.addEventListener('mouseout', (e) => {
//setFrequency = false;
//});
container.after(audioOptions); container.after(audioOptions);