diff --git a/src/MissionManager/QGCMapPolygon.cc b/src/MissionManager/QGCMapPolygon.cc index d8471b0ea0d41c56c5fb117dfac2e5a3941c9609..a7c5ca9ae01194587dfaa5dce7628b84c5e1c6c3 100644 --- a/src/MissionManager/QGCMapPolygon.cc +++ b/src/MissionManager/QGCMapPolygon.cc @@ -253,6 +253,8 @@ void QGCMapPolygon::removeVertex(int vertexIndex) _polygonPath.removeAt(vertexIndex); emit pathChanged(); + + _updateCenter(); } void QGCMapPolygon::_polygonModelCountChanged(int count) @@ -265,9 +267,13 @@ void QGCMapPolygon::_updateCenter(void) if (!_ignoreCenterUpdates) { QGeoCoordinate center; - if (_polygonPath.count() > 2) { - QPointF centerPoint = _toPolygonF().boundingRect().center(); - center = _coordFromPointF(centerPoint); + if (_polygonPath.count() > 2) { + QPointF centroid(0, 0); + QPolygonF polygonF = _toPolygonF(); + for (int i=0; i