Fixed the find functions so they're offset by the scroll position, not

absolute
This commit is contained in:
Joel Holdsworth 2009-01-02 15:25:45 +00:00
parent 2a9f1764c8
commit 8ad308e679
2 changed files with 12 additions and 4 deletions

View file

@ -88,8 +88,12 @@ TimelineLayoutHelper::get_track_header_rect(
} }
shared_ptr<timeline::Track> shared_ptr<timeline::Track>
TimelineLayoutHelper::header_from_point(const Gdk::Point &point) TimelineLayoutHelper::header_from_point(Gdk::Point point)
{ {
// Apply the scroll offset
point.set_y(point.get_y() + timelineWidget.get_y_scroll_offset());
// Search the headers
std::pair<weak_ptr<timeline::Track>, Gdk::Rectangle> pair; std::pair<weak_ptr<timeline::Track>, Gdk::Rectangle> pair;
BOOST_FOREACH( pair, headerBoxes ) BOOST_FOREACH( pair, headerBoxes )
{ {
@ -108,8 +112,12 @@ TimelineLayoutHelper::header_from_point(const Gdk::Point &point)
} }
boost::shared_ptr<timeline::Track> boost::shared_ptr<timeline::Track>
TimelineLayoutHelper::track_from_y(const int y) TimelineLayoutHelper::track_from_y(int y)
{ {
// Apply the scroll offset
y += timelineWidget.get_y_scroll_offset();
// Search the tracks
std::pair<weak_ptr<timeline::Track>, Gdk::Rectangle> pair; std::pair<weak_ptr<timeline::Track>, Gdk::Rectangle> pair;
BOOST_FOREACH( pair, headerBoxes ) BOOST_FOREACH( pair, headerBoxes )
{ {

View file

@ -70,9 +70,9 @@ public:
boost::weak_ptr<timeline::Track> track); boost::weak_ptr<timeline::Track> track);
boost::shared_ptr<timeline::Track> header_from_point( boost::shared_ptr<timeline::Track> header_from_point(
const Gdk::Point &point); Gdk::Point point);
boost::shared_ptr<timeline::Track> track_from_y(const int y); boost::shared_ptr<timeline::Track> track_from_y(int y);
int get_total_height() const; int get_total_height() const;