Browse Source

Pull request #12488: REPORT-100623 控件-参数面板根据参数自动生成的控件,页面放大后无法点击

Merge in DESIGN/design from ~OBO/design1:release/11.0 to release/11.0

* commit 'a28fc37a8a382702be7150da78965d04c6e73e06':
  REPORT-100623 优化下代码
  REPORT-100623 方法名写成大写字母开头了,修复下
  REPORT-100623 获取rootContainer时加上竖直方向的偏移
  REPORT-100623 补充上竖直方向的偏移
  REPORT-99924 提到bugfix了,回退一下
  REPORT-99924 提到bugfix了,回退一下
  REPORT-100623 控件-参数面板根据参数自动生成的控件,页面放大后无法点击
  REPORT-99924 FR10升级到11后,导出图片字体显示问题
newui
Obo-王学仁 1 year ago
parent
commit
51bda38ed4
  1. 27
      designer-form/src/main/java/com/fr/design/designer/creator/XEditorHolder.java
  2. 23
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  3. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

27
designer-form/src/main/java/com/fr/design/designer/creator/XEditorHolder.java

@ -44,9 +44,7 @@ public class XEditorHolder extends XWidgetCreator {
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this);
editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter); editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter);
Rectangle rect = this.getBounds(); Rectangle rect = this.getBounds();
int min = rect.x + rect.width / 2 - editingMouseListener.getMinMoveSize(); if (checkMouseEditRangeValid(e, rect, editingMouseListener)) {
int max = rect.x + rect.width / 2 + editingMouseListener.getMinMoveSize();
if (e.getX() > min && e.getX() < max) {
ToolTipEditor.getInstance().showToolTip((XEditorHolder) this, e.getXOnScreen(), ToolTipEditor.getInstance().showToolTip((XEditorHolder) this, e.getXOnScreen(),
e.getYOnScreen()); e.getYOnScreen());
} }
@ -54,6 +52,29 @@ public class XEditorHolder extends XWidgetCreator {
} }
} }
/**
* 判断当前鼠标事件是否在可编辑区域内
*
* @param e 鼠标事件
* @param rect 区域
* @param editingMouseListener 位置处理器
* @return 是否位于可编辑区
*/
private boolean checkMouseEditRangeValid(MouseEvent e, Rectangle rect, EditingMouseListener editingMouseListener) {
int horizontalValue = editingMouseListener.getDesigner().getHorizontalScaleValue();
int verticalValue = editingMouseListener.getDesigner().getVerticalScaleValue();
int minMoveSize = editingMouseListener.getMinMoveSize();
int minHorizontal = rect.x + rect.width / 2 - minMoveSize - horizontalValue;
int maxHorizontal = rect.x + rect.width / 2 + minMoveSize - horizontalValue;
int minVertical = rect.y + rect.height / 2 - minMoveSize - verticalValue;
int maxVertical = rect.y + rect.height / 2 + minMoveSize - verticalValue;
boolean xRangeValid = e.getX() > minHorizontal && e.getX() < maxHorizontal;
boolean yRangeValid = e.getY() > minVertical && e.getY() < maxVertical;
return xRangeValid && yRangeValid;
}
@Override @Override
protected String getIconName() { protected String getIconName() {
return "text_field_16.png"; return "text_field_16.png";

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

@ -279,9 +279,7 @@ public class EditingMouseListener extends MouseInputAdapter {
if (component instanceof XEditorHolder) { if (component instanceof XEditorHolder) {
XEditorHolder xcreator = (XEditorHolder) component; XEditorHolder xcreator = (XEditorHolder) component;
Rectangle rect = xcreator.getBounds(); Rectangle rect = xcreator.getBounds();
int min = rect.x + rect.width / 2 - minMoveSize; if (checkCreatorRangeValid(e, rect)) {
int max = rect.x + rect.width / 2 + minMoveSize;
if (e.getX() > min && e.getX() < max) {
if (designer.getCursor().getType() != Cursor.HAND_CURSOR) { if (designer.getCursor().getType() != Cursor.HAND_CURSOR) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
} }
@ -673,8 +671,8 @@ public class EditingMouseListener extends MouseInputAdapter {
currentEditor = designerEditor; currentEditor = designerEditor;
currentXCreator = creator; currentXCreator = creator;
Rectangle bounds = new Rectangle(1, 1, creator.getWidth() - 2, creator.getHeight() - 2); Rectangle bounds = new Rectangle(1, 1, creator.getWidth() - 2, creator.getHeight() - 2);
bounds.x += (rect.x - designer.getArea().getHorizontalValue()); bounds.x += (rect.x - designer.getHorizontalScaleValue());
bounds.y += (rect.y - designer.getArea().getVerticalValue()); bounds.y += (rect.y - designer.getVerticalScaleValue());
designerEditor.getEditorTarget().setBounds(bounds); designerEditor.getEditorTarget().setBounds(bounds);
designer.add(designerEditor.getEditorTarget()); designer.add(designerEditor.getEditorTarget());
designer.invalidate(); designer.invalidate();
@ -747,4 +745,19 @@ public class EditingMouseListener extends MouseInputAdapter {
refreshTopXCreator(false); refreshTopXCreator(false);
} }
/**
* 判断当前鼠标移动事件是否在Creator有效范围内
*/
private boolean checkCreatorRangeValid(MouseEvent e, Rectangle rect) {
int horizontalValue = designer.getHorizontalScaleValue();
int verticalValue = designer.getVerticalScaleValue();
int minHorizontal = rect.x + rect.width / 2 - minMoveSize - horizontalValue;
int maxHorizontal = rect.x + rect.width / 2 + minMoveSize - horizontalValue;
int minVertical = rect.y + rect.height / 2 - minMoveSize - verticalValue;
int maxVertical = rect.y + rect.height / 2 + minMoveSize - verticalValue;
boolean xRangeValid = e.getX() > minHorizontal && e.getX() < maxHorizontal;
boolean yRangeValid = e.getY() > minVertical && e.getY() < maxVertical;
return xRangeValid && yRangeValid;
}
} }

2
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -1208,7 +1208,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
public XLayoutContainer getRootContainer(int y) { public XLayoutContainer getRootContainer(int y) {
XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent; XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() / scale ? paraComponent : rootComponent;
if (container == null) { if (container == null) {
container = rootComponent; container = rootComponent;
} }

Loading…
Cancel
Save