slight tweaks to knob wheel flow
parent
cf81f91a0b
commit
c6e22d3521
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue