Browse Source

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

bugfix/10.0
hades 4 years ago
parent
commit
df2cf4f867
  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[] veris = getVeris(true);
int containerWidth = 0; int containerWidth = 0;
int containerHeight = 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++) { for (int index=0, n=this.getComponentCount(); index<n; index++) {
XCreator creator = (XCreator) this.getComponent(index); XCreator creator = (XCreator) this.getComponent(index);
BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData()); BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData());
@ -782,6 +787,14 @@ public class XWFitLayout extends XLayoutContainer {
} }
//如果子组件是绝对布局,则内部的widget也要更新 //如果子组件是绝对布局,则内部的widget也要更新
if (creator.acceptType(XWAbsoluteLayout.class)){ if (creator.acceptType(XWAbsoluteLayout.class)){
// backupBounds处理下内边距 否则计算缩放比例时总是存在一个内边距的误差
if (creator.getBackupBound() != null) {
Rectangle backUpBound = creator.getBackupBound();
processContainerMargin(margin, backUpBound, maxW, maxH);
creator.setBackupBound(backUpBound);
}
//更新的时候一定要带上backupBound //更新的时候一定要带上backupBound
if (creator.getBackupBound() == null && wgt.getBeforeScaleBounds() != null) { if (creator.getBackupBound() == null && wgt.getBeforeScaleBounds() != null) {
creator.setBackupBound(dealWgtBound(wgt.getBeforeScaleBounds())); creator.setBackupBound(dealWgtBound(wgt.getBeforeScaleBounds()));
@ -1056,24 +1069,28 @@ public class XWFitLayout extends XLayoutContainer {
for (int i=0; i<num; i++) { for (int i=0; i<num; i++) {
Component comp = this.getComponent(i); Component comp = this.getComponent(i);
Rectangle rec = comp.getBounds(); Rectangle rec = comp.getBounds();
if (rec.x == margin.getLeft()) { processContainerMargin(margin, rec, maxW, maxH);
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();
}
comp.setBounds(rec); 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) { public Component getTopComp(int x, int y) {
int val = getAcualInterval(); int val = getAcualInterval();
return this.getComponentAt(x, y-default_Length-val); return this.getComponentAt(x, y-default_Length-val);

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

@ -273,7 +273,9 @@ public class FormSelection {
for (XCreator creator : selection) { for (XCreator creator : selection) {
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator); LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator);
if (layoutAdapter != null) { 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); Rectangle rectangle = recs.get(i);
check4ParaPane(rectangle); check4ParaPane(rectangle);
creator.setBackupBound(rectangle); creator.setBackupBound(rectangle);

Loading…
Cancel
Save