From f22f5725d55a6dad12153ceb1a0ab20cfaf200f0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 27 Jun 2014 10:19:21 -0400 Subject: [PATCH] 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 --- libs/canvas/canvas.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 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::const_iterator i = root_children.begin(); i != root_children.end(); ++i) { - if (((sg = dynamic_cast(*i)) != 0) && sg->covers_window (d)) { + if (((sg = dynamic_cast(*i)) != 0) && sg->covers_window (in_window)) { break; } }