Browse Source

REPORT-64149

feature/x
方磊 3 years ago
parent
commit
ab0f9b090e
  1. 31
      designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java
  2. 11
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

31
designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java

@ -36,7 +36,7 @@ public class StateModel {
private SelectionModel selectionModel;
// 当前鼠标进入拖拽区域的位置类型
private Direction driection;
private Direction direction;
// 当前拖拽的起始位置
private int currentX;
@ -74,7 +74,7 @@ public class StateModel {
* @return direction方向
*/
public Direction getDirection() {
return driection;
return direction;
}
/**
@ -96,7 +96,7 @@ public class StateModel {
* @return 非outer且选中为空
*/
public boolean dragable() {
return ((driection != Location.outer) && !selecting);
return ((direction != Location.outer) && !selecting);
}
/**
@ -108,7 +108,7 @@ public class StateModel {
addable = false;
designer.setPainter(null);
if (driection != Location.inner) {
if (direction != Location.inner) {
return;
}
@ -283,7 +283,7 @@ public class StateModel {
*/
public void startResizing(MouseEvent e) {
if (!selectionModel.getSelection().isEmpty()) {
driection.backupBounds(designer);
direction.backupBounds(designer);
}
currentX = getMouseXY(e).x;
currentY = getMouseXY(e).y;
@ -409,7 +409,7 @@ public class StateModel {
* 重置
*/
public void reset() {
driection = Location.outer;
direction = Location.outer;
aspectRatioLocked = false;
dragging = false;
selecting = false;
@ -429,9 +429,9 @@ public class StateModel {
* @param dir 拉伸方向
*/
public void setDirection(Direction dir) {
if (driection != dir) {
this.driection = dir;
driection.updateCursor(designer);
if (direction != dir) {
this.direction = dir;
direction.updateCursor(designer);
}
}
@ -495,7 +495,7 @@ public class StateModel {
FormSelection selection = this.selectionModel.getSelection();
this.aspectRatioLocked = selection.isCreatorAspectRatioLockedInAbsLayout(designer) ||
(this.selectionModel.getSelection().isCreatorInAbsLayout(designer) && e.isShiftDown());
driection.drag(getMouseXY(e).x - currentX, getMouseXY(e).y - currentY, designer);
direction.drag(getMouseXY(e).x - currentX, getMouseXY(e).y - currentY, designer);
this.dragging = true;
}
@ -552,4 +552,15 @@ public class StateModel {
+ designer.getArea().getVerticalValue());
}
public boolean isDraggingSize() {
return direction == Location.left
|| direction == Location.left_top
|| direction == Location.left_bottom
|| direction == Location.right
|| direction == Location.right_top
|| direction == Location.right_bottom
|| direction == Location.top
|| direction == Location.bottom;
}
}

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

@ -463,7 +463,7 @@ public class EditingMouseListener extends MouseInputAdapter {
}
// 调整大小这边单独提出来,不跟后面拖组件混在一起,实在不好管理
if (isDraggingSize()) {
if (stateModel.isDraggingSize()) {
stateModel.dragging(e);
return;
}
@ -473,15 +473,6 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.repaint();
}
/**
* 是否正在调整大小
*
* @return
*/
private boolean isDraggingSize() {
return stateModel.getDirection() != Location.inner && stateModel.getDirection() != Location.outer;
}
/**
* 当前拖拽是否是正在shift或者control拖拽一个选择框
* @param e

Loading…
Cancel
Save