mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 13:45:43 +01:00
fix problem with calls to Editor::trackview_by_y_position() when using motion events. The coordinate passed in was in canvas space and the method expected trackview space
To handle any further issues like this, I generalized and added an optional argument specifying that the canvas=>trackview transform is required, thus centralizing where this done.
This commit is contained in:
parent
b86e1204ec
commit
92bb0e0d7f
3 changed files with 13 additions and 6 deletions
|
|
@ -2421,7 +2421,8 @@ Editor::get_state ()
|
|||
return *node;
|
||||
}
|
||||
|
||||
/** @param y y is an offset into the trackview area, in pixel units
|
||||
/** if @param trackview_relative_offset is true, @param y y is an offset into the trackview area, in pixel units
|
||||
* if @param trackview_relative_offset is false, @param y y is a global canvas * coordinate, in pixel units
|
||||
*
|
||||
* @return pair: TimeAxisView that y is over, layer index.
|
||||
*
|
||||
|
|
@ -2429,12 +2430,16 @@ Editor::get_state ()
|
|||
* in stacked or expanded region display mode, otherwise 0.
|
||||
*/
|
||||
std::pair<TimeAxisView *, double>
|
||||
Editor::trackview_by_y_position (double y)
|
||||
Editor::trackview_by_y_position (double y, bool trackview_relative_offset)
|
||||
{
|
||||
if (!trackview_relative_offset) {
|
||||
y -= _trackview_group->canvas_origin().y;
|
||||
}
|
||||
|
||||
if (y < 0) {
|
||||
return std::make_pair ( (TimeAxisView *) 0, 0);
|
||||
}
|
||||
|
||||
|
||||
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
|
||||
|
||||
std::pair<TimeAxisView*, double> const r = (*iter)->covers_y_position (y);
|
||||
|
|
@ -2443,6 +2448,8 @@ Editor::trackview_by_y_position (double y)
|
|||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_pair ( (TimeAxisView *) 0, 0);
|
||||
}
|
||||
|
||||
/** Snap a position to the grid, if appropriate, taking into account current
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue