diff --git a/src/GUI/mapview.cpp b/src/GUI/mapview.cpp index c11b886c..d0fc1390 100644 --- a/src/GUI/mapview.cpp +++ b/src/GUI/mapview.cpp @@ -273,7 +273,7 @@ void MapView::setMap(Map *map) _map->load(); connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap())); - resetDigitalZoom(); + digitalZoom(0); _map->zoomFit(resolution, center); _scene->setSceneRect(_map->bounds()); @@ -374,31 +374,17 @@ void MapView::clearMapCache() resetCachedContent(); } -void MapView::resetDigitalZoom() -{ - QHash, WaypointItem*>::const_iterator it; - - _digitalZoom = 0; - resetTransform(); - - for (int i = 0; i < _tracks.size(); i++) - _tracks.at(i)->setDigitalZoom(0); - for (int i = 0; i < _routes.size(); i++) - _routes.at(i)->setDigitalZoom(0); - for (int i = 0; i < _waypoints.size(); i++) - _waypoints.at(i)->setDigitalZoom(0); - for (it = _pois.constBegin(); it != _pois.constEnd(); it++) - it.value()->setDigitalZoom(0); - - _mapScale->setDigitalZoom(0); -} - void MapView::digitalZoom(int zoom) { QHash, WaypointItem*>::const_iterator it; - _digitalZoom += zoom; - scale(pow(2, zoom), pow(2, zoom)); + if (zoom) { + _digitalZoom += zoom; + scale(pow(2, zoom), pow(2, zoom)); + } else { + _digitalZoom = 0; + resetTransform(); + } for (int i = 0; i < _tracks.size(); i++) _tracks.at(i)->setDigitalZoom(_digitalZoom); @@ -472,7 +458,7 @@ void MapView::keyPressEvent(QKeyEvent *event) else if (event->matches(ZOOM_OUT)) z = -1; else if (_digitalZoom && event->key() == Qt::Key_Escape) { - resetDigitalZoom(); + digitalZoom(0); return; } else { QGraphicsView::keyPressEvent(event); @@ -575,7 +561,7 @@ void MapView::clear() _rr = RectC(); _wr = RectC(); - resetDigitalZoom(); + digitalZoom(0); resetCachedContent(); QPixmapCache::clear(); } diff --git a/src/GUI/mapview.h b/src/GUI/mapview.h index 089eb6d7..09b47195 100644 --- a/src/GUI/mapview.h +++ b/src/GUI/mapview.h @@ -83,7 +83,6 @@ private: void centerOn(const QPointF &pos); void zoom(int zoom, const QPoint &pos, const Coordinates &c); void digitalZoom(int zoom); - void resetDigitalZoom(); void updatePOIVisibility(); void mouseDoubleClickEvent(QMouseEvent *event);