From fafc8e71ff4af176736cdbc932f61783afcd019c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 17 Feb 2022 17:08:00 +0800 Subject: [PATCH] REPORT-66947 --- .../com/fr/design/mainframe/FormDesignerUI.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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 1d641dece..8307e945f 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 @@ -116,8 +116,8 @@ public class FormDesignerUI extends ComponentUI { designer.getPainter().paint(g, designer.getArea().getHorizontalValue(), designer.getArea().getVerticalValue() + designer.getParaHeight()); } - DraggingModel draggingModel = designer.getDraggingModel(); - if (draggingModel != null && draggingModel.getCreator() != null) { + + if (needPaintDraggingBean()) { // 当前正在添加的组件 paintDraggingBean(g); } @@ -217,6 +217,19 @@ public class FormDesignerUI extends ComponentUI { ComponentUtils.resetBuffer(dbcomponents); } + private boolean needPaintDraggingBean() { + DraggingModel draggingModel = designer.getDraggingModel(); + if (draggingModel == null || draggingModel.getCreator() == null) { + return false; + } + + XCreator creator = draggingModel.getCreator(); + int leftTopX = draggingModel.getCreatorLeftTopX(); + int leftTopY = draggingModel.getCreatorLeftTopY(); + + return leftTopX + creator.getWidth() > 0 && leftTopY + creator.getHeight() > 0; + } + private void paintAuthorityCreator(Graphics2D g2d, Rectangle creatorBounds) { back_or_selection_rect.setRect(creatorBounds.getX(), creatorBounds.getY(),