13
0

in Canvas::window_to_canvas(), if either x or y coordinate is less than zero, search for the scroll group on the relevant edge.

If we don't do this then we find no scroll group covering the event coordinate, and the translation for scroll fails to be applied
This commit is contained in:
Paul Davis 2014-06-27 10:19:21 -04:00
parent 19ff353665
commit 6cc673f0a6

View File

@ -231,8 +231,21 @@ Canvas::window_to_canvas (Duple const & d) const
std::list<Item*> const& root_children (_root.items());
ScrollGroup* sg = 0;
/* if the coordinates are negative, clamp to zero and find the item
* that covers that "edge" position.
*/
Duple in_window (d);
if (in_window.x < 0) {
in_window.x = 0;
}
if (in_window.y < 0) {
in_window.y = 0;
}
for (std::list<Item*>::const_iterator i = root_children.begin(); i != root_children.end(); ++i) {
if (((sg = dynamic_cast<ScrollGroup*>(*i)) != 0) && sg->covers_window (d)) {
if (((sg = dynamic_cast<ScrollGroup*>(*i)) != 0) && sg->covers_window (in_window)) {
break;
}
}