diff options
author | David Robillard <d@drobilla.net> | 2013-12-30 01:48:16 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-12-30 01:48:16 +0000 |
commit | 9dc1556740cb8fb22dc6ed03f3e3d9100bdff515 (patch) | |
tree | b6748059121633df8c14788275b683abe447b698 /src | |
parent | a7ead0901863725d24103f98096a91fcc36b8f8a (diff) | |
download | ganv-9dc1556740cb8fb22dc6ed03f3e3d9100bdff515.tar.gz ganv-9dc1556740cb8fb22dc6ed03f3e3d9100bdff515.tar.bz2 ganv-9dc1556740cb8fb22dc6ed03f3e3d9100bdff515.zip |
Fix control sensitivity.
Fix controls close to screen edge.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5223 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/Canvas.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp index 4d59b6f..89cea9d 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -1427,7 +1427,7 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port) const int screen_height = gdk_screen_get_height(screen); const double drag_dx = mouse_x - control_start_x; const double drag_dy = mouse_y - control_start_y; - const double xpad = 100.0; // Pad from screen edge + const double xpad = 8.0; // Pad from screen edge const double ythresh = 0.2; // Minimum y fraction for fine const double range_x = ((drag_dx > 0) @@ -1445,11 +1445,10 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port) ? port->impl->control->max - control_start_value : control_start_value - port->impl->control->min; - const double fine = (dy < 0.20) - ? 0.0 - : ((dy - ythresh) * (1/(1 + ythresh))); + const double sens = (dy < ythresh) + ? 1.0 + : 1.0 - fabs(drag_dy / (range_y + ythresh)); - const double sens = fmaxf(1.0 - fine, value_range / range_x); const double dvalue = (dx * value_range) * sens; double value = control_start_value + dvalue; if (value < port->impl->control->min) { |