13
0

ScrollGroup::covers_{window,canvas}() need to account for possible non-zero position of the group.

They also do NOT need to consider scroll offset
This commit is contained in:
Paul Davis 2015-01-24 14:08:19 -05:00
parent e84e1f7403
commit ccd881d518

View File

@ -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);
}