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.
This commit is contained in:
parent
56e3195b65
commit
9f13c49d29
2 changed files with 9 additions and 0 deletions
|
@ -386,6 +386,7 @@ MapWidget::MapWidget(int x, int y, int maxX, int maxY) :
|
||||||
_zoom = 6;
|
_zoom = 6;
|
||||||
_width = maxX - x;
|
_width = maxX - x;
|
||||||
_height = maxY - y;
|
_height = maxY - y;
|
||||||
|
_hasPanned = false;
|
||||||
|
|
||||||
MapData::setFont(legendFont);
|
MapData::setFont(legendFont);
|
||||||
MapData::setPalette(colour);
|
MapData::setPalette(colour);
|
||||||
|
@ -496,6 +497,7 @@ int MapWidget::checkKey (int key, int updown )
|
||||||
|
|
||||||
void MapWidget::pan(const SGVec2d& delta)
|
void MapWidget::pan(const SGVec2d& delta)
|
||||||
{
|
{
|
||||||
|
_hasPanned = true;
|
||||||
_projectionCenter = unproject(-delta);
|
_projectionCenter = unproject(-delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,6 +527,12 @@ void MapWidget::draw(int dx, int dy)
|
||||||
fgGetDouble("/position/latitude-deg"));
|
fgGetDouble("/position/latitude-deg"));
|
||||||
_magneticHeadings = _root->getBoolValue("magnetic-headings");
|
_magneticHeadings = _root->getBoolValue("magnetic-headings");
|
||||||
|
|
||||||
|
if (_hasPanned)
|
||||||
|
{
|
||||||
|
_root->setBoolValue("centre-on-aircraft", false);
|
||||||
|
_hasPanned = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
if (_root->getBoolValue("centre-on-aircraft")) {
|
if (_root->getBoolValue("centre-on-aircraft")) {
|
||||||
_projectionCenter = _aircraft;
|
_projectionCenter = _aircraft;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ private:
|
||||||
double _drawRangeNm;
|
double _drawRangeNm;
|
||||||
double _upHeading; // true heading corresponding to +ve y-axis
|
double _upHeading; // true heading corresponding to +ve y-axis
|
||||||
bool _magneticHeadings;
|
bool _magneticHeadings;
|
||||||
|
bool _hasPanned;
|
||||||
|
|
||||||
SGGeod _projectionCenter;
|
SGGeod _projectionCenter;
|
||||||
SGGeod _aircraft;
|
SGGeod _aircraft;
|
||||||
|
|
Loading…
Reference in a new issue