Browse Source

REPORT-54374 拖拽修改tab里的绝对画布块高度,绝对画布块错乱 右侧设置面板修改高度,绝对画布块内部组件位移成画布块

zheng-1641779399395
hades 3 years ago
parent
commit
f902d06d5f
  1. 45
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  2. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

45
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -758,6 +758,11 @@ public class XWFitLayout extends XLayoutContainer {
int[] veris = getVeris(true);
int containerWidth = 0;
int containerHeight = 0;
PaddingMargin margin = toData().getMargin();
int maxW = this.getWidth() - margin.getRight();
int maxH = this.getHeight() - margin.getBottom();
for (int index=0, n=this.getComponentCount(); index<n; index++) {
XCreator creator = (XCreator) this.getComponent(index);
BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData());
@ -793,6 +798,14 @@ public class XWFitLayout extends XLayoutContainer {
BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData());
//如果子组件是绝对布局,则内部的widget也要更新
if (creator.acceptType(XWAbsoluteLayout.class)){
// backupBounds处理下内边距 否则计算缩放比例时总是存在一个内边距的误差
if (creator.getBackupBound() != null) {
Rectangle backUpBound = creator.getBackupBound();
processContainerMargin(margin, backUpBound, maxW, maxH);
creator.setBackupBound(backUpBound);
}
//更新的时候一定要带上backupBound
if (creator.getBackupBound() == null && wgt.getBeforeScaleBounds() != null) {
creator.setBackupBound(dealWgtBound(wgt.getBeforeScaleBounds()));
@ -1064,24 +1077,28 @@ public class XWFitLayout extends XLayoutContainer {
for (int i=0; i<num; i++) {
Component comp = this.getComponent(i);
Rectangle rec = comp.getBounds();
if (rec.x == margin.getLeft()) {
rec.x = 0;
rec.width += margin.getLeft();
}
if (rec.y == margin.getTop()) {
rec.y = 0;
rec.height += margin.getTop();
}
if (rec.x +rec.width == maxW) {
rec.width += margin.getRight();
}
if (rec.y + rec.height == maxH) {
rec.height += margin.getBottom();
}
processContainerMargin(margin, rec, maxW, maxH);
comp.setBounds(rec);
}
}
private void processContainerMargin(PaddingMargin margin, Rectangle rec, int maxW, int maxH) {
if (rec.x == margin.getLeft()) {
rec.x = 0;
rec.width += margin.getLeft();
}
if (rec.y == margin.getTop()) {
rec.y = 0;
rec.height += margin.getTop();
}
if (rec.x +rec.width == maxW) {
rec.width += margin.getRight();
}
if (rec.y + rec.height == maxH) {
rec.height += margin.getBottom();
}
}
public Component getTopComp(int x, int y) {
int val = getAcualInterval();
return this.getComponentAt(x, y-default_Length-val);

4
designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

@ -277,7 +277,9 @@ public class FormSelection {
for (XCreator creator : selection) {
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator);
if (layoutAdapter != null) {
if (creator.acceptType(XWAbsoluteLayout.class) && recs.size() > i) {
// 这里处理绝对画布块 仅局限于选中多个组件且其中包含了绝对画布块的情况
boolean accept = creator.acceptType(XWAbsoluteLayout.class) && recs.size() > i && selection.size() > 1;
if (accept) {
Rectangle rectangle = recs.get(i);
check4ParaPane(rectangle);
creator.setBackupBound(rectangle);

Loading…
Cancel
Save