Skip to content

Commit

Permalink
fixed homeHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Bernasocchi authored and pka committed Jul 5, 2011
1 parent 7a96956 commit b0f3d4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -259,7 +259,7 @@ void GlobePlugin::setupMap()
struct PanControlHandler : public NavigationControlHandler
{
PanControlHandler( osgEarthUtil::EarthManipulator* manip, double dx, double dy ) : _manip( manip ), _dx( dx ), _dy( dy ) { }
virtual void onMouseDown( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
virtual void onMouseDown( Control* control, int mouseButtonMask )
{
_manip->pan( _dx, _dy );
}
Expand All @@ -272,7 +272,7 @@ struct PanControlHandler : public NavigationControlHandler
struct RotateControlHandler : public NavigationControlHandler
{
RotateControlHandler( osgEarthUtil::EarthManipulator* manip, double dx, double dy ) : _manip( manip ), _dx( dx ), _dy( dy ) { }
virtual void onMouseDown( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
virtual void onMouseDown( Control* control, int mouseButtonMask )
{
if( 0 == _dx && 0 == _dy )
{
Expand All @@ -292,7 +292,7 @@ struct RotateControlHandler : public NavigationControlHandler
struct ZoomControlHandler : public NavigationControlHandler
{
ZoomControlHandler( osgEarthUtil::EarthManipulator* manip, double dx, double dy ) : _manip( manip ), _dx( dx ), _dy( dy ) { }
virtual void onMouseDown( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
virtual void onMouseDown( Control* control, int mouseButtonMask )
{
_manip->zoom( _dx, _dy );
}
Expand All @@ -305,7 +305,7 @@ struct ZoomControlHandler : public NavigationControlHandler
struct HomeControlHandler : public NavigationControlHandler
{
HomeControlHandler( osgEarthUtil::EarthManipulator* manip ) : _manip( manip ) { }
virtual void onMouseDown( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
virtual void onClick( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
_manip->home( ea, aa );
}
Expand Down Expand Up @@ -696,7 +696,11 @@ bool NavigationControl::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActi
for( ControlEventHandlerList::const_iterator i = _eventHandlers.begin(); i != _eventHandlers.end(); ++i )
{
NavigationControlHandler* handler = dynamic_cast<NavigationControlHandler*>( i->get() );
if( handler ) handler->onMouseDown( this, ea.getButtonMask(), ea, aa );
if( handler )
{
handler->onMouseDown( this, ea.getButtonMask() );
handler->onClick( this, ea.getButtonMask(), ea, aa );
}
}
}
return Control::handle( ea, aa, cx );
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/globe/globe_plugin.h
Expand Up @@ -123,6 +123,7 @@ class FlyToExtentHandler : public osgGA::GUIEventHandler
GlobePlugin* mGlobe;
};


class KeyboardControlHandler : public osgGA::GUIEventHandler
{
public:
Expand All @@ -144,7 +145,8 @@ namespace osgEarthUtil
class NavigationControlHandler : public ControlEventHandler
{
public:
virtual void onMouseDown( class Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { }
virtual void onMouseDown( class Control* control, int mouseButtonMask ) { }
virtual void onClick( class Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa ) { }
};

class NavigationControl : public ImageControl
Expand Down

0 comments on commit b0f3d4e

Please sign in to comment.