X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fcanvas%2FCanvasEventVisitor.cxx;h=efb12dbb49ad0073c0558d869765f75021dd17b6;hb=d3a14bfd612efa7c7e2dda444bfc85fdbf2ebbcf;hp=9fbae2c84a73a64a784bcdd2c2d5ccd6d68e68c2;hpb=f28e3fc9bbbdade41053e024bbbc9d49cb7202f4;p=simgear.git diff --git a/simgear/canvas/CanvasEventVisitor.cxx b/simgear/canvas/CanvasEventVisitor.cxx index 9fbae2c8..efb12dbb 100644 --- a/simgear/canvas/CanvasEventVisitor.cxx +++ b/simgear/canvas/CanvasEventVisitor.cxx @@ -20,7 +20,6 @@ #include "CanvasEvent.hxx" #include "CanvasEventVisitor.hxx" #include -#include namespace simgear { @@ -35,10 +34,7 @@ namespace canvas _root(root) { if( mode == TRAVERSE_DOWN ) - { - EventTarget target = {ElementWeakPtr(), pos}; - _target_path.push_back(target); - } + _target_path.push_back( EventTarget(NULL, pos) ); } //---------------------------------------------------------------------------- @@ -69,11 +65,11 @@ namespace canvas // catch all events which have no target. This allows for example calling // event listeners attached to the canvas itself (its root group) even if // no element has been hit. - if( _root.get() != &el && !el.hitBound(pos, local_pos) ) + if( _root.get() != &el + && !el.hitBound(_target_path.front().local_pos, pos, local_pos) ) return false; - EventTarget target = {el.getWeakPtr(), local_pos}; - _target_path.push_back(target); + _target_path.push_back( EventTarget(&el, local_pos) ); if( el.traverse(*this) || &el == _root.get() ) return true;