From commits-return-12518-archive-asf-public=cust-asf.ponee.io@pdfbox.apache.org Sat Apr 28 11:03:35 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 39EC8180649 for ; Sat, 28 Apr 2018 11:03:35 +0200 (CEST) Received: (qmail 73227 invoked by uid 500); 28 Apr 2018 09:03:33 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 73218 invoked by uid 99); 28 Apr 2018 09:03:33 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 28 Apr 2018 09:03:33 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id DDE293A00E7 for ; Sat, 28 Apr 2018 09:03:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1830416 - /pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java Date: Sat, 28 Apr 2018 09:03:32 -0000 To: commits@pdfbox.apache.org From: tilman@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20180428090332.DDE293A00E7@svn01-us-west.apache.org> Author: tilman Date: Sat Apr 28 09:03:32 2018 New Revision: 1830416 URL: http://svn.apache.org/viewvc?rev=1830416&view=rev Log: PDFBOX-4207: apply default transform to mouse coordinates Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java Modified: pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java?rev=1830416&r1=1830415&r2=1830416&view=diff ============================================================================== --- pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java (original) +++ pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/pagepane/PagePane.java Sat Apr 28 09:03:32 2018 @@ -77,6 +77,8 @@ public class PagePane implements ActionL private ViewMenu viewMenu; private String labelText = ""; private final Map rectMap = new HashMap<>(); + private final AffineTransform defaultTransform = GraphicsEnvironment.getLocalGraphicsEnvironment(). + getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform(); public PagePane(PDDocument document, COSDictionary pageDict, JLabel statuslabel) { @@ -256,8 +258,8 @@ public class PagePane implements ActionL float offsetX = page.getCropBox().getLowerLeftX(); float offsetY = page.getCropBox().getLowerLeftY(); float zoomScale = zoomMenu.getPageZoomScale(); - float x = e.getX() / zoomScale; - float y = e.getY() / zoomScale; + float x = e.getX() / zoomScale * (float) defaultTransform.getScaleX(); + float y = e.getY() / zoomScale * (float) defaultTransform.getScaleY(); int x1, y1; switch ((RotationMenu.getRotationDegrees() + page.getRotation()) % 360) { @@ -388,10 +390,8 @@ public class PagePane implements ActionL // a smaller size than the image to compensate that the // image is scaled up with some screen configurations (e.g. 125% on windows). // See PDFBOX-3665 for more sample code and discussion. - AffineTransform tx = GraphicsEnvironment.getLocalGraphicsEnvironment(). - getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform(); - label.setSize((int) Math.ceil(image.getWidth() / tx.getScaleX()), - (int) Math.ceil(image.getHeight() / tx.getScaleY())); + label.setSize((int) Math.ceil(image.getWidth() / defaultTransform.getScaleX()), + (int) Math.ceil(image.getHeight() / defaultTransform.getScaleY())); label.setIcon(new HighResolutionImageIcon(image, label.getWidth(), label.getHeight())); label.setText(null); }