slight tweaks to knob wheel flow

master
zetaPRIME 2022-03-21 15:54:32 -04:00
parent cf81f91a0b
commit c6e22d3521
1 changed files with 16 additions and 7 deletions

View File

@ -185,19 +185,28 @@ void KnobGadget::mouseMoveEvent(QGraphicsSceneMouseEvent* e) {
}
void KnobGadget::wheelEvent(QGraphicsSceneWheelEvent* e) {
if (highlighted) return;
e->accept(); // never pass through
wAcc += e->delta();
auto d = accumulate(wAcc, 120);
if (d == 0) return; // don't need to update anything if incomplete accumulation
auto mod = e->modifiers();
if (mod.testFlag(Qt::ShiftModifier) && subStep > 0) {
fSet(std::clamp(stepRound(get()+subStep*d, subStep), min, max));
e->accept();
} else if (step > 0) {
fSet(std::clamp(stepRound(get()+step*d, step), min, max));
e->accept();
if (highlighted) { // wheel while dragging
/*if (mod.testFlag(Qt::ShiftModifier) && subStep > 0) {
trackVal = stepRound(trackVal + subStep*d, subStep);
fSet(std::clamp(trackVal, min, max));
} else if (step > 0) {
trackVal = stepRound(trackVal + step*d, step);
fSet(std::clamp(trackVal, min, max));
}*/
return;
}
if (mod.testFlag(Qt::ShiftModifier) && subStep > 0)
fSet(std::clamp(stepRound(get()+subStep*d, subStep), min, max));
else if (step > 0)
fSet(std::clamp(stepRound(get()+step*d, step), min, max));
update();
}