From 3ff2fb115f0a60e00c5566a8fcdfcaf973e60894 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Mon, 4 May 2020 18:31:40 +0200 Subject: [PATCH] fix rotation in images viewer --- .../fanfix_swing/gui/viewer/ViewerImages.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/be/nikiroo/fanfix_swing/gui/viewer/ViewerImages.java b/src/be/nikiroo/fanfix_swing/gui/viewer/ViewerImages.java index db072ddc..554c3504 100644 --- a/src/be/nikiroo/fanfix_swing/gui/viewer/ViewerImages.java +++ b/src/be/nikiroo/fanfix_swing/gui/viewer/ViewerImages.java @@ -366,13 +366,22 @@ public class ViewerImages extends JFrame { new SwingWorker() { @Override protected ImageIcon doInBackground() throws Exception { + Rotation rotation = ViewerImages.this.rotation; + boolean turn = (rotation == Rotation.LEFT + || rotation == Rotation.RIGHT); + BufferedImage image = ImageUtilsAwt.fromImage(img, rotation); BufferedImage resizedImage = ImageUtilsAwt.scaleImage( areaSize, image, zoom, zoomSnapWidth); - currentZoom = (1.0 * resizedImage.getWidth()) - / image.getWidth(); + if (!turn) { + currentZoom = (1.0 * resizedImage.getWidth()) + / image.getWidth(); + } else { + currentZoom = (1.0 * resizedImage.getHeight()) + / image.getWidth(); + } return new ImageIcon(resizedImage); } -- 2.27.0