Skip to content

Commit

Permalink
Fixed edit template and tile collision editor views
Browse files Browse the repository at this point in the history
This broke in commit 3b27c6a.

The addition of making the map fit into view by default caused a near
infinite scale to be set on these views because their map has 0 size,
making them appear entirely white and perform badly.
  • Loading branch information
bjorn committed Nov 13, 2019
1 parent 7cadb46 commit 9dc290e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tiled/mapview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,11 @@ void MapView::setScale(qreal scale)

void MapView::fitMapInView()
{
const QRectF rect = mapScene()->mapBoundingRect();
if (rect.isEmpty())
return;

// Scale and center map to fit in view
QRectF rect = mapScene()->mapBoundingRect();
centerOn(rect.center());
setScale(std::min(width() / rect.width(), height() / rect.height()) * 0.95);
}
Expand Down

0 comments on commit 9dc290e

Please sign in to comment.