From ab0f9b090efe83c982d99f9b8467b0498b8b9153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 7 Jan 2022 20:35:11 +0800 Subject: [PATCH] REPORT-64149 --- .../designer/beans/models/StateModel.java | 31 +++++++++++++------ .../mainframe/EditingMouseListener.java | 11 +------ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java index 3b676921b..390c45825 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java +++ b/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; + } + } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index 9ec566eac..f48b60320 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/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