Update DnD min. movement threshold -- #8686

Previously x-axis threshold was in samples. This is
useless unless zoomed in to the max. So in most cases
the first-move was always in x-direction, making constrained
y-axis drags near impossible.

Furthermore the threshold for copy-drags was increased
as per #8686
This commit is contained in:
Robin Gareus 2021-05-08 04:28:36 +02:00
parent 4d815554dd
commit ce1e05fc3d
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 21 additions and 15 deletions

View file

@ -439,13 +439,13 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll)
return false;
}
pair<samplecnt_t, int> const threshold = move_threshold ();
pair<int, int> const threshold = move_threshold ();
bool const old_move_threshold_passed = _move_threshold_passed;
if (!_move_threshold_passed) {
bool const xp = (::llabs (_drags->current_pointer_sample () - _raw_grab_sample) >= threshold.first);
bool const xp = (::fabs ((current_pointer_x () - _grab_x)) >= threshold.first);
bool const yp = (::fabs ((current_pointer_y () - _grab_y)) >= threshold.second);
_move_threshold_passed = ((xp && x_movement_matters()) || (yp && y_movement_matters()));

View file

@ -197,8 +197,8 @@ public:
return _preview_video;
}
/** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
virtual std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
/** @return minimum number of pixels (x, y) that should be considered a movement */
virtual std::pair<int, int> move_threshold () const {
return std::make_pair (1, 1);
}
@ -425,8 +425,12 @@ public:
return true;
}
std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
return std::make_pair (4, 4);
std::pair<int, int> move_threshold () const {
if (_copy) {
return std::make_pair (6, 4);
} else {
return std::make_pair (2, 4);
}
}
void setup_pointer_sample_offset ();
@ -639,8 +643,8 @@ private:
double y_to_region (double) const;
ARDOUR::samplecnt_t grid_samples (samplepos_t) const;
/** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
virtual std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
/** @return minimum number of pixels (x, y) that should be considered a movement */
virtual std::pair<int, int> move_threshold () const {
return std::make_pair (0, 0);
}
@ -672,8 +676,8 @@ private:
double y_to_region (double) const;
ARDOUR::samplecnt_t grid_samples (samplepos_t) const;
/** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
virtual std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
/** @return minimum number of pixels (x, y) that should be considered a movement */
virtual std::pair<int, int> move_threshold () const {
return std::make_pair (0, 0);
}
@ -1139,8 +1143,9 @@ public:
void finished (GdkEvent *, bool);
void aborted (bool);
std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
return std::make_pair (8, 1);
/** @return minimum number of pixels (x, y) that should be considered a movement */
std::pair<int, int> move_threshold () const {
return std::make_pair (1, 1);
}
void do_select_things (GdkEvent *, bool);
@ -1297,7 +1302,8 @@ public:
void finished (GdkEvent *, bool);
void aborted (bool);
std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
/** @return minimum number of pixels (x, y) that should be considered a movement */
std::pair<int, int> move_threshold () const {
return std::make_pair (4, 4);
}
@ -1361,8 +1367,8 @@ public:
return false;
}
virtual std::pair<ARDOUR::samplecnt_t, int> move_threshold () const {
return std::make_pair (4, 4);
virtual std::pair<int, int> move_threshold () const {
return std::make_pair (1, 4);
}
private: