Skip to content

Commit

Permalink
Final Wheel Support for ModButton (#1020)
Browse files Browse the repository at this point in the history
The ModButton wheel on windows was too slow; speed it up. While I'm
in there support shift-wheel also just for completeness.

Closes #1008
  • Loading branch information
baconpaul authored Aug 13, 2019
1 parent 9a2e69e commit df90134
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/common/gui/CModulationSourceButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,20 @@ double CModulationSourceButton::getMouseDeltaScaling(CPoint& where, const CButto

bool CModulationSourceButton::onWheel(const VSTGUI::CPoint& where, const float &distance, const VSTGUI::CButtonState& buttons)
{
value += distance / (double)(getWidth());
auto rate = 1.f;

#if WINDOWS
// This is purely empirical. The wheel for this control feels slow on windows
// but fine on a macos trackpad. I callibrated it by making sure the trackpad
// across the pad gesture on my macbook pro moved the control the same amount
// in surge mac as it does in vst3 bitwig in parallels.
rate = 10.f;
#endif

if( buttons & kShift )
rate *= 0.05;

value += rate * distance / (double)(getWidth());
value = limit_range(value, 0.f, 1.f);
event_is_drag = true;
invalid();
Expand Down

0 comments on commit df90134

Please sign in to comment.