Browse Source

Merge pull request #529 in BA/design from ~KERRY/design:master to master

* commit '17bae7f17f25580b8a8b81fda2e5555a8efb9e71':
  REPORT-578 自适应编辑宽高不需要根据依附位置调整
master
superman 8 years ago
parent
commit
cfdbb3b81c
  1. 13
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  2. 1
      designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java

13
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -42,7 +42,16 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
public static final String WIDGETPANEICONPATH = "/com/fr/web/images/form/resources/layout_absolute.png"; public static final String WIDGETPANEICONPATH = "/com/fr/web/images/form/resources/layout_absolute.png";
private static final int DEPENDING_SCOPE = 3; private static final int DEPENDING_SCOPE = 3;
private HoverPainter painter; private HoverPainter painter;
//区分拖拽和编辑宽高
private boolean isEdit;
public boolean isEdit() {
return isEdit;
}
public void setEdit(boolean edit) {
isEdit = edit;
}
/** /**
* 构造函数 * 构造函数
* *
@ -411,6 +420,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
// 根据需要依附的位置调整拖拽的坐标值 // 根据需要依附的位置调整拖拽的坐标值
private int adjustCoordinateByDependingLine(int coordinate, int[] coordinates) { private int adjustCoordinateByDependingLine(int coordinate, int[] coordinates) {
if(!isEdit) {
for (int i = 0; i < coordinates.length; i++) { for (int i = 0; i < coordinates.length; i++) {
if (coordinate == coordinates[i]) { if (coordinate == coordinates[i]) {
continue; continue;
@ -420,17 +430,20 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
break; break;
} }
} }
}
return coordinate; return coordinate;
} }
// 根据需要依附的位置调整拖拽的距离 // 根据需要依附的位置调整拖拽的距离
private int adjustDiffByDependingLine(int coordinate, int[] coordinates, int diff) { private int adjustDiffByDependingLine(int coordinate, int[] coordinates, int diff) {
if(!isEdit) {
for (int i = 0; i < coordinates.length; i++) { for (int i = 0; i < coordinates.length; i++) {
if (coordinate + diff > coordinates[i] - DEPENDING_SCOPE && coordinate + diff < coordinates[i] + DEPENDING_SCOPE) { if (coordinate + diff > coordinates[i] - DEPENDING_SCOPE && coordinate + diff < coordinates[i] + DEPENDING_SCOPE) {
diff = coordinates[i] - coordinate; diff = coordinates[i] - coordinate;
break; break;
} }
} }
}
return diff; return diff;
} }

1
designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java

@ -128,6 +128,7 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel {
Rectangle backupBounds = getBounds(); Rectangle backupBounds = getBounds();
FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) AdapterBus.searchLayoutAdapter(formDesigner, xCreator); FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) AdapterBus.searchLayoutAdapter(formDesigner, xCreator);
if (layoutAdapter != null) { if (layoutAdapter != null) {
layoutAdapter.setEdit(true);
layoutAdapter.calculateBounds(backupBounds, bounds, xCreator, row, difference); layoutAdapter.calculateBounds(backupBounds, bounds, xCreator, row, difference);
} }
return true; return true;

Loading…
Cancel
Save