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 1d641decef..8307e945f6 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(),