diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2016-02-11 15:21:46 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2016-02-11 15:21:46 +1000 |
commit | fb9e75ebb52be6699c6bbcf1f48bcb83f7b8d3d6 (patch) | |
tree | 35346e5dd73ef69bc9b08b543009c568fde03442 | |
parent | 148f2ab8e560fa5f794c5f578b7e5fdb9d568157 (diff) | |
download | ardour-origin/5983-drag-threshold.zip ardour-origin/5983-drag-threshold.tar.gz ardour-origin/5983-drag-threshold.tar.bz2 |
Change/Fix EditorDrag::move_threshold to use pixel units for both x and y thresholdsorigin/5983-drag-threshold
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.h | 19 |
2 files changed, 16 insertions, 10 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 21cd043..4926622 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -387,14 +387,13 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll) return false; } - pair<framecnt_t, int> const threshold = move_threshold (); + pair<double, double> const threshold = move_threshold (); bool const old_move_threshold_passed = _move_threshold_passed; if (!_move_threshold_passed) { - - bool const xp = (::llabs (_drags->current_pointer_frame () - _raw_grab_frame) >= threshold.first); - bool const yp = (::fabs ((current_pointer_y () - _grab_y)) >= threshold.second); + bool const xp = (fabs(pointer_delta_from_grab_x()) >= threshold.first); + bool const yp = (fabs(pointer_delta_from_grab_y()) >= threshold.second); _move_threshold_passed = ((xp && x_movement_matters()) || (yp && y_movement_matters())); } diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index cd1b0c2..729e288 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -180,8 +180,9 @@ public: return true; } - /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */ - virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const { + /** @return minimum number of pixels (in x) and pixels (in y) that should be + * considered a movement */ + virtual std::pair<double, double> move_threshold () const { return std::make_pair (1, 1); } @@ -243,6 +244,12 @@ protected: double current_pointer_x () const; double current_pointer_y () const; + double pointer_delta_from_grab_x () const + { return current_pointer_x() - grab_x(); } + + double pointer_delta_from_grab_y () const + { return current_pointer_y() - grab_y(); } + /* sets snap delta from unsnapped pos */ void setup_snap_delta (framepos_t pos); @@ -391,7 +398,7 @@ public: return true; } - std::pair<ARDOUR::framecnt_t, int> move_threshold () const { + std::pair<double, double> move_threshold () const { return std::make_pair (4, 4); } @@ -918,7 +925,7 @@ public: void finished (GdkEvent *, bool); void aborted (bool); - std::pair<ARDOUR::framecnt_t, int> move_threshold () const { + std::pair<double, double> move_threshold () const { return std::make_pair (8, 1); } @@ -1076,7 +1083,7 @@ public: void finished (GdkEvent *, bool); void aborted (bool); - std::pair<ARDOUR::framecnt_t, int> move_threshold () const { + std::pair<double, double> move_threshold () const { return std::make_pair (4, 4); } @@ -1140,7 +1147,7 @@ class CrossfadeEdgeDrag : public Drag return false; } - virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const { + virtual std::pair<double, double> move_threshold () const { return std::make_pair (4, 4); } |