mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-08-01 05:02:26 -04:00
Merge pull request #357 from vsonnier/manual_gain_final_fix
Fix limitless manual gain slider while using mouse wheel
This commit is contained in:
commit
00d3140c0d
@ -164,6 +164,15 @@ void GainCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
|||||||
gInfo = gainInfo[panelHit];
|
gInfo = gainInfo[panelHit];
|
||||||
|
|
||||||
gInfo->current = gInfo->current + ((movement / 100.0) * ((gInfo->high - gInfo->low) / 100.0));
|
gInfo->current = gInfo->current + ((movement / 100.0) * ((gInfo->high - gInfo->low) / 100.0));
|
||||||
|
|
||||||
|
//BEGIN Clamp to prevent the meter to escape
|
||||||
|
if (gInfo->current > gInfo->high) {
|
||||||
|
gInfo->current = gInfo->high;
|
||||||
|
}
|
||||||
|
if (gInfo->current < gInfo->low) {
|
||||||
|
gInfo->current = gInfo->low;
|
||||||
|
}
|
||||||
|
|
||||||
gInfo->changed = true;
|
gInfo->changed = true;
|
||||||
|
|
||||||
float levelVal = float(gInfo->current-gInfo->low)/float(gInfo->high-gInfo->low);
|
float levelVal = float(gInfo->current-gInfo->low)/float(gInfo->high-gInfo->low);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user