@@ -259,7 +259,7 @@ void GlobePlugin::setupMap()
259
259
struct PanControlHandler : public NavigationControlHandler
260
260
{
261
261
PanControlHandler ( osgEarthUtil::EarthManipulator* manip, double dx, double dy ) : _manip( manip ), _dx( dx ), _dy( dy ) { }
262
- virtual void onMouseDown ( Control* control, int mouseButtonMask )
262
+ virtual void onMouseDown ( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
263
263
{
264
264
_manip->pan ( _dx, _dy );
265
265
}
@@ -272,7 +272,7 @@ struct PanControlHandler : public NavigationControlHandler
272
272
struct RotateControlHandler : public NavigationControlHandler
273
273
{
274
274
RotateControlHandler ( osgEarthUtil::EarthManipulator* manip, double dx, double dy ) : _manip( manip ), _dx( dx ), _dy( dy ) { }
275
- virtual void onMouseDown ( Control* control, int mouseButtonMask )
275
+ virtual void onMouseDown ( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
276
276
{
277
277
if ( 0 == _dx && 0 == _dy )
278
278
{
@@ -292,7 +292,7 @@ struct RotateControlHandler : public NavigationControlHandler
292
292
struct ZoomControlHandler : public NavigationControlHandler
293
293
{
294
294
ZoomControlHandler ( osgEarthUtil::EarthManipulator* manip, double dx, double dy ) : _manip( manip ), _dx( dx ), _dy( dy ) { }
295
- virtual void onMouseDown ( Control* control, int mouseButtonMask )
295
+ virtual void onMouseDown ( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
296
296
{
297
297
_manip->zoom ( _dx, _dy );
298
298
}
@@ -302,15 +302,12 @@ struct ZoomControlHandler : public NavigationControlHandler
302
302
double _dy;
303
303
};
304
304
305
- struct HomeControlHandler : public ControlEventHandler
305
+ struct HomeControlHandler : public NavigationControlHandler
306
306
{
307
307
HomeControlHandler ( osgEarthUtil::EarthManipulator* manip ) : _manip( manip ) { }
308
- virtual void onClick ( Control* control, int mouseButtonMask )
308
+ virtual void onMouseDown ( Control* control, int mouseButtonMask, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
309
309
{
310
- _manip->setRotation ( osg::Quat () );
311
- // FIXME: instead of next 2 lines use _manip->home( control->ea, control->aa );
312
- osgEarthUtil::Viewpoint viewpoint ( osg::Vec3d ( -90 , 0 , 0.0 ), 0.0 , -90.0 , 3e7 );
313
- _manip->setViewpoint ( viewpoint, 4.0 );
310
+ _manip->home ( ea, aa );
314
311
}
315
312
private:
316
313
osg::observer_ptr<osgEarthUtil::EarthManipulator> _manip;
@@ -699,7 +696,7 @@ bool NavigationControl::handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActi
699
696
for ( ControlEventHandlerList::const_iterator i = _eventHandlers.begin (); i != _eventHandlers.end (); ++i )
700
697
{
701
698
NavigationControlHandler* handler = dynamic_cast <NavigationControlHandler*>( i->get () );
702
- if ( handler ) handler->onMouseDown ( this , ea.getButtonMask () );
699
+ if ( handler ) handler->onMouseDown ( this , ea.getButtonMask (), ea, aa );
703
700
}
704
701
}
705
702
return Control::handle ( ea, aa, cx );
0 commit comments