From 4db084214fa6f3a36f0b2b0d0c637066ba934332 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 10 Aug 2020 15:44:00 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-36612=20&&=20REPORT-37010=20&&=20REPORT-?= =?UTF-8?q?37062=20=E7=BC=A9=E6=94=BE=E9=AA=8C=E6=94=B6bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/FormArea.java | 2 +- .../com/fr/design/mainframe/FormDesigner.java | 19 ++++++++++++++++++- .../fr/design/mainframe/FormDesignerUI.java | 7 ------- .../mainframe/ReportComponentComposite.java | 2 +- .../form/FormReportComponentComposite.java | 2 +- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index 05edb3192..967cabd06 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -117,7 +117,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { addFormRuler(); } this.setFocusTraversalKeysEnabled(false); - this.addMouseWheelListener(showValSpinnerMouseWheelListener); + this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener); registerShortCutKey(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index b7d8a9a4c..b138e3b35 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -83,10 +83,12 @@ import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseEvent; +import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; @@ -993,7 +995,7 @@ public class FormDesigner extends TargetComponent
implements TreeSelection @Nullable public XCreator getComponentAt(int x, int y, XCreator[] except) { - XLayoutContainer container = y + this.getPaintY() < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent; + XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent; if (container == null) { container = rootComponent; } @@ -1281,6 +1283,21 @@ public class FormDesigner extends TargetComponent implements TreeSelection this.formArea = formArea; } + + + public void paint(Graphics g){ + //重新设置下绘制的起点和缩放幅度 + AffineTransform at = new AffineTransform(); + if (rootComponent.getParent() != null) { + at.translate(this.getPaintX(), this.getPaintY()); + at.scale(this.getScale(), this.getScale()); + Graphics2D g2 = (Graphics2D) g; + g2.transform(at); + } + super.paint(g); + } + + /** * 绘制组件根节点 * diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 404a0fd13..ee49cd66e 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -68,13 +68,6 @@ public class FormDesignerUI extends ComponentUI { public void paint(final Graphics g, JComponent c) { XCreator rootComponent = designer.getRootComponent(); this.time = (float) designer.getResolution() / ScreenResolution.getScreenResolution(); - AffineTransform at = new AffineTransform(); - if (rootComponent.getParent() != null) { - at.translate(designer.getPaintX(), designer.getPaintY()); - at.scale(designer.getScale(), designer.getScale()); - Graphics2D g2 = (Graphics2D) g; - g2.transform(at); - } if (rootComponent != null) { // 设计自适应界面 repaintFit(g, rootComponent, c); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java index 4b74ab4dd..84ae83838 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java @@ -35,7 +35,7 @@ public class ReportComponentComposite extends JComponent implements RemoveListen private static final int MAX = 400; private static final int HUND = 100; private static final int MIN = 10; - private static final int DIR = 15; + private static final int DIR = 10; private JWorkBook parent; private UIModeControlContainer parentContainer = null; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java index d173762b4..cf64757c2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/form/FormReportComponentComposite.java @@ -35,7 +35,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo private static final int MAX = 400; private static final int HUND = 100; private static final int MIN = 10; - private static final int DIR = 15; + private static final int DIR = 10; private static final double MIN_TIME = 0.4; public FormElementCaseDesigner elementCaseDesigner; private BaseJForm jForm;