]> git.mxchange.org Git - flightgear.git/commitdiff
issue #316: panning not working when center-on-aircraft enabled
authorThorstenB <brehmt@gmail.com>
Fri, 20 May 2011 17:48:05 +0000 (19:48 +0200)
committerThorstenB <brehmt@gmail.com>
Fri, 20 May 2011 17:48:05 +0000 (19:48 +0200)
Panning feature looked broken to some users since auto-center is enabled
by default which blocks panning. center-on-aircraft is now disabled
automatically when view is panned.

src/GUI/MapWidget.cxx
src/GUI/MapWidget.hxx

index cd648fefb3ad1f91917b8a60ea319ca7320ff4be..e3cc5de772d8aa4dab79d706316a7c52ec753579 100644 (file)
@@ -386,6 +386,7 @@ MapWidget::MapWidget(int x, int y, int maxX, int maxY) :
   _zoom = 6;
   _width = maxX - x;
   _height = maxY - y;
+  _hasPanned = false;
 
   MapData::setFont(legendFont);
   MapData::setPalette(colour);
@@ -496,6 +497,7 @@ int MapWidget::checkKey (int key, int updown )
 
 void MapWidget::pan(const SGVec2d& delta)
 {
+  _hasPanned = true; 
   _projectionCenter = unproject(-delta);
 }
 
@@ -525,6 +527,12 @@ void MapWidget::draw(int dx, int dy)
     fgGetDouble("/position/latitude-deg"));
   _magneticHeadings = _root->getBoolValue("magnetic-headings");
 
+  if (_hasPanned)
+  {
+      _root->setBoolValue("centre-on-aircraft", false);
+      _hasPanned = false;
+  }
+  else
   if (_root->getBoolValue("centre-on-aircraft")) {
     _projectionCenter = _aircraft;
   }
index f2722e327f32e71d15df3e77ab6e2d314751d314..ce9333e32ae78319c187b3f8a4de7a5be6d9aa9e 100644 (file)
@@ -85,6 +85,7 @@ private:
   double _drawRangeNm;
   double _upHeading; // true heading corresponding to +ve y-axis
   bool _magneticHeadings;
+  bool _hasPanned;
   
   SGGeod _projectionCenter;
   SGGeod _aircraft;