|
|
@ -279,9 +279,7 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
if (component instanceof XEditorHolder) { |
|
|
|
if (component instanceof XEditorHolder) { |
|
|
|
XEditorHolder xcreator = (XEditorHolder) component; |
|
|
|
XEditorHolder xcreator = (XEditorHolder) component; |
|
|
|
Rectangle rect = xcreator.getBounds(); |
|
|
|
Rectangle rect = xcreator.getBounds(); |
|
|
|
int min = rect.x + rect.width / 2 - minMoveSize; |
|
|
|
if (checkCreatorRangeValid(e, rect)) { |
|
|
|
int max = rect.x + rect.width / 2 + minMoveSize; |
|
|
|
|
|
|
|
if (e.getX() > min && e.getX() < max) { |
|
|
|
|
|
|
|
if (designer.getCursor().getType() != Cursor.HAND_CURSOR) { |
|
|
|
if (designer.getCursor().getType() != Cursor.HAND_CURSOR) { |
|
|
|
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
|
|
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
|
|
} |
|
|
|
} |
|
|
@ -673,8 +671,8 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
currentEditor = designerEditor; |
|
|
|
currentEditor = designerEditor; |
|
|
|
currentXCreator = creator; |
|
|
|
currentXCreator = creator; |
|
|
|
Rectangle bounds = new Rectangle(1, 1, creator.getWidth() - 2, creator.getHeight() - 2); |
|
|
|
Rectangle bounds = new Rectangle(1, 1, creator.getWidth() - 2, creator.getHeight() - 2); |
|
|
|
bounds.x += (rect.x - designer.getArea().getHorizontalValue()); |
|
|
|
bounds.x += (rect.x - designer.getHorizontalScaleValue()); |
|
|
|
bounds.y += (rect.y - designer.getArea().getVerticalValue()); |
|
|
|
bounds.y += (rect.y - designer.getVerticalScaleValue()); |
|
|
|
designerEditor.getEditorTarget().setBounds(bounds); |
|
|
|
designerEditor.getEditorTarget().setBounds(bounds); |
|
|
|
designer.add(designerEditor.getEditorTarget()); |
|
|
|
designer.add(designerEditor.getEditorTarget()); |
|
|
|
designer.invalidate(); |
|
|
|
designer.invalidate(); |
|
|
@ -747,4 +745,19 @@ public class EditingMouseListener extends MouseInputAdapter { |
|
|
|
refreshTopXCreator(false); |
|
|
|
refreshTopXCreator(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 判断当前鼠标移动事件是否在Creator有效范围内 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private boolean checkCreatorRangeValid(MouseEvent e, Rectangle rect) { |
|
|
|
|
|
|
|
int horizontalValue = designer.getHorizontalScaleValue(); |
|
|
|
|
|
|
|
int verticalValue = designer.getVerticalScaleValue(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int minHorizontal = rect.x + rect.width / 2 - minMoveSize - horizontalValue; |
|
|
|
|
|
|
|
int maxHorizontal = rect.x + rect.width / 2 + minMoveSize - horizontalValue; |
|
|
|
|
|
|
|
int minVertical = rect.y + rect.height / 2 - minMoveSize - verticalValue; |
|
|
|
|
|
|
|
int maxVertical = rect.y + rect.height / 2 + minMoveSize - verticalValue; |
|
|
|
|
|
|
|
boolean xRangeValid = e.getX() > minHorizontal && e.getX() < maxHorizontal; |
|
|
|
|
|
|
|
boolean yRangeValid = e.getY() > minVertical && e.getY() < maxVertical; |
|
|
|
|
|
|
|
return xRangeValid && yRangeValid; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|