mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
Change/Fix EditorDrag::move_threshold to use pixel units for both x and y thresholds
This commit is contained in:
parent
148f2ab8e5
commit
fb9e75ebb5
2 changed files with 16 additions and 10 deletions
|
|
@ -387,14 +387,13 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll)
|
||||||
return false;
|
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;
|
bool const old_move_threshold_passed = _move_threshold_passed;
|
||||||
|
|
||||||
if (!_move_threshold_passed) {
|
if (!_move_threshold_passed) {
|
||||||
|
bool const xp = (fabs(pointer_delta_from_grab_x()) >= threshold.first);
|
||||||
bool const xp = (::llabs (_drags->current_pointer_frame () - _raw_grab_frame) >= threshold.first);
|
bool const yp = (fabs(pointer_delta_from_grab_y()) >= threshold.second);
|
||||||
bool const yp = (::fabs ((current_pointer_y () - _grab_y)) >= threshold.second);
|
|
||||||
|
|
||||||
_move_threshold_passed = ((xp && x_movement_matters()) || (yp && y_movement_matters()));
|
_move_threshold_passed = ((xp && x_movement_matters()) || (yp && y_movement_matters()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -180,8 +180,9 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */
|
/** @return minimum number of pixels (in x) and pixels (in y) that should be
|
||||||
virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
|
* considered a movement */
|
||||||
|
virtual std::pair<double, double> move_threshold () const {
|
||||||
return std::make_pair (1, 1);
|
return std::make_pair (1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,6 +244,12 @@ protected:
|
||||||
double current_pointer_x () const;
|
double current_pointer_x () const;
|
||||||
double current_pointer_y () 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 */
|
/* sets snap delta from unsnapped pos */
|
||||||
void setup_snap_delta (framepos_t pos);
|
void setup_snap_delta (framepos_t pos);
|
||||||
|
|
||||||
|
|
@ -391,7 +398,7 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
|
std::pair<double, double> move_threshold () const {
|
||||||
return std::make_pair (4, 4);
|
return std::make_pair (4, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -918,7 +925,7 @@ public:
|
||||||
void finished (GdkEvent *, bool);
|
void finished (GdkEvent *, bool);
|
||||||
void aborted (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);
|
return std::make_pair (8, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1076,7 +1083,7 @@ public:
|
||||||
void finished (GdkEvent *, bool);
|
void finished (GdkEvent *, bool);
|
||||||
void aborted (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);
|
return std::make_pair (4, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1140,7 +1147,7 @@ class CrossfadeEdgeDrag : public Drag
|
||||||
return false;
|
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);
|
return std::make_pair (4, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue