mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Code cleanup
This commit is contained in:
parent
cf81e42f52
commit
abc987cb0c
@ -421,7 +421,7 @@ void MapView::digitalZoom(int zoom)
|
|||||||
_mapScale->setDigitalZoom(_digitalZoom);
|
_mapScale->setDigitalZoom(_digitalZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::zoom(int zoom, const QPoint &pos, const Coordinates &c)
|
void MapView::zoom(int zoom, const QPoint &pos)
|
||||||
{
|
{
|
||||||
bool shift = QApplication::keyboardModifiers() & Qt::ShiftModifier;
|
bool shift = QApplication::keyboardModifiers() & Qt::ShiftModifier;
|
||||||
|
|
||||||
@ -433,9 +433,9 @@ void MapView::zoom(int zoom, const QPoint &pos, const Coordinates &c)
|
|||||||
|
|
||||||
digitalZoom(zoom);
|
digitalZoom(zoom);
|
||||||
} else {
|
} else {
|
||||||
qreal os, ns;
|
Coordinates c = _map->xy2ll(mapToScene(pos));
|
||||||
os = _map->zoom();
|
qreal os = _map->zoom();
|
||||||
ns = (zoom > 0) ? _map->zoomIn() : _map->zoomOut();
|
qreal ns = (zoom > 0) ? _map->zoomIn() : _map->zoomOut();
|
||||||
|
|
||||||
if (ns != os) {
|
if (ns != os) {
|
||||||
rescale();
|
rescale();
|
||||||
@ -456,8 +456,7 @@ void MapView::wheelEvent(QWheelEvent *event)
|
|||||||
return;
|
return;
|
||||||
deg = 0;
|
deg = 0;
|
||||||
|
|
||||||
Coordinates c = _map->xy2ll(mapToScene(event->pos()));
|
zoom((event->delta() > 0) ? 1 : -1, event->pos());
|
||||||
zoom((event->delta() > 0) ? 1 : -1, event->pos(), c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::mouseDoubleClickEvent(QMouseEvent *event)
|
void MapView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
@ -465,8 +464,7 @@ void MapView::mouseDoubleClickEvent(QMouseEvent *event)
|
|||||||
if (event->button() != Qt::LeftButton && event->button() != Qt::RightButton)
|
if (event->button() != Qt::LeftButton && event->button() != Qt::RightButton)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Coordinates c = _map->xy2ll(mapToScene(event->pos()));
|
zoom((event->button() == Qt::LeftButton) ? 1 : -1, event->pos());
|
||||||
zoom((event->button() == Qt::LeftButton) ? 1 : -1, event->pos(), c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::keyPressEvent(QKeyEvent *event)
|
void MapView::keyPressEvent(QKeyEvent *event)
|
||||||
@ -474,7 +472,6 @@ void MapView::keyPressEvent(QKeyEvent *event)
|
|||||||
int z;
|
int z;
|
||||||
|
|
||||||
QPoint pos = viewport()->rect().center();
|
QPoint pos = viewport()->rect().center();
|
||||||
Coordinates c = _map->xy2ll(mapToScene(pos));
|
|
||||||
|
|
||||||
if (event->matches(ZOOM_IN))
|
if (event->matches(ZOOM_IN))
|
||||||
z = 1;
|
z = 1;
|
||||||
@ -488,7 +485,7 @@ void MapView::keyPressEvent(QKeyEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
zoom(z, pos, c);
|
zoom(z, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||||
|
@ -84,7 +84,7 @@ private:
|
|||||||
QPointF contentCenter() const;
|
QPointF contentCenter() const;
|
||||||
void rescale();
|
void rescale();
|
||||||
void centerOn(const QPointF &pos);
|
void centerOn(const QPointF &pos);
|
||||||
void zoom(int zoom, const QPoint &pos, const Coordinates &c);
|
void zoom(int zoom, const QPoint &pos);
|
||||||
void digitalZoom(int zoom);
|
void digitalZoom(int zoom);
|
||||||
void updatePOIVisibility();
|
void updatePOIVisibility();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user