Skip to content

Commit

Permalink
Fixes when no overlay is set.
Browse files Browse the repository at this point in the history
Would be better to have an overlay list.
  • Loading branch information
eddy-geek committed Jun 14, 2023
1 parent 86cb3b7 commit 9443881
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/GUI/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ TreeNode<MapAction*> GUI::createMapActionsNode(const TreeNode<Map*> &node, QActi

for (int i = 0; i < node.items().size(); i++) {
Map *map = node.items().at(i);
if (map->isValid()) {
if (map && map->isValid()) {
MapAction *a = new MapAction(map, actionGroup);
connect(a, &MapAction::loaded, this, &GUI::mapInitialized);
tree.addItem(a);
Expand Down Expand Up @@ -772,6 +772,7 @@ void GUI::createToolBars()
void GUI::createMapView()
{
_map = new EmptyMap(this);
_overlay = new EmptyMap(this);
_mapView = new MapView(_map, _poi, this);
_mapView->setSizePolicy(QSizePolicy(QSizePolicy::Ignored,
QSizePolicy::Expanding));
Expand Down
6 changes: 3 additions & 3 deletions src/GUI/mapview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ int MapView::fitMapZoom() const

int z = _map->zoomFit(viewport()->size() - QSize(2*MARGIN, 2*MARGIN),
br.isNull() ? _map->llBounds(_inputProjection) : br);
_overlay->setZoom(z);
if (_overlay)
_overlay->setZoom(z);
return z;
}

Expand Down Expand Up @@ -615,9 +616,8 @@ void MapView::zoom(int zoom, const QPoint &pos, bool shift)
Coordinates c = _map->xy2ll(mapToScene(pos));
int oz = _map->zoom();
int nz = (zoom > 0) ? _map->zoomIn() : _map->zoomOut();
if (_overlay) {
if (_overlay)
_overlay->setZoom(_map->zoom());
}

if (nz != oz) {
rescale();
Expand Down

0 comments on commit 9443881

Please sign in to comment.