|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |