diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-01-24 14:08:19 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-01-24 18:48:28 -0500 |
commit | ccd881d518521fa56a43a66632bedf814710105f (patch) | |
tree | b41fd518701d6d7be08df077b8f4e49e45aefcff /libs/canvas | |
parent | e84e1f74030ad123cd1ba08331b5ef5df1835129 (diff) |
ScrollGroup::covers_{window,canvas}() need to account for possible non-zero position of the group.
They also do NOT need to consider scroll offset
Diffstat (limited to 'libs/canvas')
-rw-r--r-- | libs/canvas/scroll_group.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libs/canvas/scroll_group.cc b/libs/canvas/scroll_group.cc index 1562643b4a..3feb37f83a 100644 --- a/libs/canvas/scroll_group.cc +++ b/libs/canvas/scroll_group.cc @@ -84,13 +84,18 @@ ScrollGroup::scroll_to (Duple const& d) bool ScrollGroup::covers_canvas (Duple const& d) const { - boost::optional<Rect> r = bounding_box (); + boost::optional<Rect> r = bounding_box (); if (!r) { return false; } - return r->contains (d); + /* Bounding box is in item coordinates, but we need + to consider the position of the bounding box + within the canvas. + */ + + return r->translate (position()).contains (d); } bool @@ -102,7 +107,10 @@ ScrollGroup::covers_window (Duple const& d) const return false; } - Rect w = r->translate (-_scroll_offset); - - return w.contains (d); + /* Bounding box is in item coordinates, but we need + to consider the position of the bounding box + within the canvas. + */ + + return r->translate (position()).contains (d); } |