process high-resolution scroll events for the frequency display

This commit is contained in:
Jakob Ketterl 2022-06-17 19:42:05 +02:00
parent 1771fd55e1
commit 8532d9048e

View File

@ -98,8 +98,13 @@ TuneableFrequencyDisplay.prototype.setupEvents = function() {
if (index < 0) return; if (index < 0) return;
var delta = 10 ** (Math.floor(Math.max(me.exponent, Math.log10(me.frequency))) - index); var delta = 10 ** (Math.floor(Math.max(me.exponent, Math.log10(me.frequency))) - index);
var newFrequency;
if ('deltaMode' in e.originalEvent && e.originalEvent.deltaMode === 0) {
newFrequency = me.frequency - delta * (e.originalEvent.deltaY / 50);
} else {
if (e.originalEvent.deltaY > 0) delta *= -1; if (e.originalEvent.deltaY > 0) delta *= -1;
var newFrequency = me.frequency + delta; newFrequency = me.frequency + delta;
}
me.element.trigger('frequencychange', newFrequency); me.element.trigger('frequencychange', newFrequency);
}); });