diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-27 10:19:21 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-27 10:19:21 -0400 |
commit | 6cc673f0a6b34caaa6429f15aec43eda464de68f (patch) | |
tree | 08e54c7640f1caafba24bc2f00bec4d9e16c3297 /libs/canvas/canvas.cc | |
parent | 19ff3536657b2f0897df3bf5edd13d94474e7c08 (diff) |
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
Diffstat (limited to 'libs/canvas/canvas.cc')
-rw-r--r-- | libs/canvas/canvas.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 27ad1f4964..33ef333c96 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -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; } } |