Skip to content

Commit

Permalink
Fix tileset zooming
Browse files Browse the repository at this point in the history
Adding support for various tile sizes in a tileset broke
Ctrl+scrollwheel zooming because the zoom level was ignored.
This fixes the regression.

Fixes #278
  • Loading branch information
encukou authored and bjorn committed Sep 21, 2012
1 parent 6b866bd commit d526f75
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tiled/tilesetview.cpp
Expand Up @@ -73,11 +73,12 @@ void TileDelegate::paint(QPainter *painter,
const QVariant display = index.model()->data(index, Qt::DisplayRole);
const QPixmap tileImage = display.value<QPixmap>();
const int extra = mTilesetView->drawGrid() ? 1 : 0;
const qreal zoom = mTilesetView->zoomable()->scale();

// Compute rectangle to draw the image in: bottom- and left-aligned
QRect targetRect = option.rect.adjusted(0, 0, -extra, -extra);
targetRect.setTop(targetRect.top() + targetRect.height() - tileImage.height());
targetRect.setRight(targetRect.right() - targetRect.width() + tileImage.width());
targetRect.setTop(targetRect.top() + targetRect.height() - tileImage.height() * zoom);
targetRect.setRight(targetRect.right() - targetRect.width() + tileImage.width() * zoom);

// Draw the tile image
if (mTilesetView->zoomable()->smoothTransform())
Expand Down

0 comments on commit d526f75

Please sign in to comment.