Skip to content

Commit 003a62a

Browse files
committed
Fix: Faulty behaviour when resizing image area
1 parent b17010a commit 003a62a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/viewer/scalable_image_label.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ void ScalableImageLabel::paintEvent(QPaintEvent* event)
159159

160160
// Resize if max-zoomed image is smaller than the available area
161161
resize |= MAX_ZOOM_RATIO * fullSizePixmap.width() < availableArea.width() && MAX_ZOOM_RATIO * fullSizePixmap.height() < availableArea.height();
162-
// Resize if fill mode is active but the image isn't fit to the available area
163-
resize |= fillMode && (pixmap().width() != availableArea.width() && pixmap().height() != availableArea.height());
164-
// Resize if fill mode is inactive but the image is smaller than the available area
165-
resize |= !fillMode && (pixmap().width() < availableArea.width() && pixmap().height() < availableArea.height());
162+
// Resize if fill mode is active but the image is bigger than the available area
163+
resize |= fillMode && (pixmap().width() > availableArea.width() || pixmap().height() > availableArea.height());
164+
// Resize if the image is smaller than the available area
165+
resize |= pixmap().width() < availableArea.width() && pixmap().height() < availableArea.height();
166166

167167
if (resize) {
168168
setPixmap(fullSizePixmap.scaled(availableArea, Qt::KeepAspectRatio, Qt::SmoothTransformation));

0 commit comments

Comments
 (0)