Permalink
Browse files

Fix tileset zooming

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 d526f75d02ddcbf0592bf605a36263d0e56c3c5b
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/tiled/tilesetview.cpp
@@ -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())

0 comments on commit d526f75

Please sign in to comment.