From 9f13c49d292825813073dc2375995238800326a6 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Fri, 20 May 2011 19:48:05 +0200 Subject: [PATCH] issue #316: panning not working when center-on-aircraft enabled 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 | 8 ++++++++ src/GUI/MapWidget.hxx | 1 + 2 files changed, 9 insertions(+) diff --git a/src/GUI/MapWidget.cxx b/src/GUI/MapWidget.cxx index cd648fefb..e3cc5de77 100644 --- a/src/GUI/MapWidget.cxx +++ b/src/GUI/MapWidget.cxx @@ -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; } diff --git a/src/GUI/MapWidget.hxx b/src/GUI/MapWidget.hxx index f2722e327..ce9333e32 100644 --- a/src/GUI/MapWidget.hxx +++ b/src/GUI/MapWidget.hxx @@ -85,6 +85,7 @@ private: double _drawRangeNm; double _upHeading; // true heading corresponding to +ve y-axis bool _magneticHeadings; + bool _hasPanned; SGGeod _projectionCenter; SGGeod _aircraft;