fix reversed dragging in stereo panner when width is negative
authorPaul Davis <paul@linuxaudiosystems.com>
Sat, 1 Jan 2011 17:34:06 +0000 (17:34 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sat, 1 Jan 2011 17:34:06 +0000 (17:34 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@8403 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/stereo_panner.cc

index 7ab526f8fa8e8deb3c0582ae5d9c43eb3e0e44bf..6b2561ce7ad68d21a1826d43e1aa5e9e252d415f 100644 (file)
@@ -393,11 +393,18 @@ StereoPanner::on_button_press_event (GdkEventButton* ev)
                         const int half_box = lr_box_size/2;
                         
                         if (ev->x >= (left - half_box) && ev->x < (left + half_box)) {
-                                dragging_left = true;
+                                if (swidth < 0.0) {
+                                        dragging_right = true;
+                                } else {
+                                        dragging_left = true;
+                                }
                         } else if (ev->x >= (right - half_box) && ev->x < (right + half_box)) {
-                                dragging_right = true;
+                                if (swidth < 0.0) {
+                                        dragging_left = true;
+                                } else {
+                                        dragging_right = true;
+                                }
                         }
-                        
                 }
 
                 dragging = true;
@@ -505,6 +512,7 @@ StereoPanner::on_motion_notify_event (GdkEventMotion* ev)
 
         int w = get_width();
         double delta = (ev->x - last_drag_x) / (double) w;
+        double current_width = width_control->get_value ();
         
         if (dragging_left) {
                 delta = -delta;
@@ -514,7 +522,6 @@ StereoPanner::on_motion_notify_event (GdkEventMotion* ev)
 
                 /* maintain position as invariant as we change the width */
 
-                double current_width = width_control->get_value ();
 
                 /* create a detent close to the center */