Browse Source

REPORT-40553 决策报表-连续点击空白设计面板,body没有处于未选中状态

final/10.0
kerry 4 years ago
parent
commit
4eacb923fb
  1. 47
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

47
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -166,7 +166,7 @@ public class EditingMouseListener extends MouseInputAdapter {
// 获取焦点,以便获取热键
designer.requestFocus();
}
if (e.getButton() == MouseEvent.BUTTON1) {
if (e.getButton() == MouseEvent.BUTTON1 && e.getX() > 0 && e.getY() > 0) {
Direction dir = selectionModel.getDirectionAt(e);
if (!DesignerMode.isAuthorityEditing()) {
@ -177,13 +177,10 @@ public class EditingMouseListener extends MouseInputAdapter {
if (designer.isDrawLineMode()) {
designer.updateDrawLineMode(e);
} else {
int relativeX = Math.max(0, e.getX());
int relativeY = Math.max(0, e.getY());
if (selectionModel.hasSelectionComponent()
&& selectionModel.getSelection().getRelativeBounds().contains(
designer.getHorizontalScaleValue() + relativeX,
designer.getVerticalScaleValue() + relativeY)) {
designer.getHorizontalScaleValue() + e.getX(),
designer.getVerticalScaleValue() + e.getY())) {
lastPressEvent = e;
lastXCreator = selectionModel.getSelection().getSelectedCreator();
} else {
@ -363,7 +360,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} // component.getParent() 是报表块所在的XWTitleLayout
int minX = button.getX() + getParentPositionX(component, 0) - designer.getHorizontalScaleValue();
int minY = button.getY() + getParentPositionY(component, 0) - designer.getVerticalScaleValue();
int minY = button.getY() + getParentPositionY(component, 0) - designer.getVerticalScaleValue() + xElementCase.getY();
if (e.getX() + GAP - xElementCase.getInsets().left > minX && e.getX() - GAP - xElementCase.getInsets().left < minX + button.getWidth()) {
if (e.getY() + GAP - xElementCase.getInsets().top > minY && e.getY() - GAP - xElementCase.getInsets().top < minY + button.getHeight()) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
@ -405,16 +402,7 @@ public class EditingMouseListener extends MouseInputAdapter {
}
private void setCoverPaneNotDisplay(XCreator component, MouseEvent e, boolean isLinkedHelpDialog) {
if (xElementCase != null) {
int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue();
int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue();
Rectangle rect = new Rectangle(x, y, xElementCase.getWidth(), xElementCase.getHeight());
if (rect.contains(e.getPoint())) {
return;
}
xElementCase.displayCoverPane(false);
}
if (xChartEditor != null) {
xChartEditor.displayCoverPane(false);
}
@ -425,6 +413,15 @@ public class EditingMouseListener extends MouseInputAdapter {
if (xTopLayoutContainer != null) {
xTopLayoutContainer.setMouseEnter(false);
}
//不知道为什么要对XElementCase进行判断,但是直接return会有bug,所以把他放在最后
if (xElementCase != null) {
int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue();
int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue();
Rectangle rect = new Rectangle(x, y, xElementCase.getWidth(), xElementCase.getHeight());
if (!rect.contains(e.getPoint())) {
xElementCase.displayCoverPane(false);
}
}
designer.repaint();
}
@ -462,7 +459,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
int minX = button.getX() + getParentPositionX(component, 0) - designer.getHorizontalScaleValue();
int minY = button.getY() + getParentPositionY(component, 0) - designer.getVerticalScaleValue();
int minY = button.getY() + getParentPositionY(component, 0) - designer.getVerticalScaleValue() + xChartEditor.getY();
if (e.getX() + GAP > minX && e.getX() - GAP < minX + button.getWidth()) {
if (e.getY() + GAP > minY && e.getY() - GAP < minY + button.getHeight()) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
@ -700,6 +697,7 @@ public class EditingMouseListener extends MouseInputAdapter {
currentXCreator.stopEditing();
currentXCreator = null;
currentEditor = null;
refreshTopXCreator();
return true;
}
return true;
@ -727,4 +725,19 @@ public class EditingMouseListener extends MouseInputAdapter {
}
currentEditor.getEditorTarget().setBounds(bounds);
}
/**
* 刷新顶层组件
* */
public void refreshTopXCreator(boolean isEditing){
designer.refreshTopXCreator(isEditing);
}
/**
* 刷新顶层组件
* */
public void refreshTopXCreator(){
refreshTopXCreator(false);
}
}

Loading…
Cancel
Save