|
|
@ -44,7 +44,7 @@ public class XEditorHolder extends XWidgetCreator { |
|
|
|
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); |
|
|
|
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); |
|
|
|
editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter); |
|
|
|
editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter); |
|
|
|
Rectangle rect = this.getBounds(); |
|
|
|
Rectangle rect = this.getBounds(); |
|
|
|
if (mouseEditRangeValid(e, rect, editingMouseListener)) { |
|
|
|
if (checkMouseEditRangeValid(e, rect, editingMouseListener)) { |
|
|
|
ToolTipEditor.getInstance().showToolTip((XEditorHolder) this, e.getXOnScreen(), |
|
|
|
ToolTipEditor.getInstance().showToolTip((XEditorHolder) this, e.getXOnScreen(), |
|
|
|
e.getYOnScreen()); |
|
|
|
e.getYOnScreen()); |
|
|
|
} |
|
|
|
} |
|
|
@ -60,14 +60,19 @@ public class XEditorHolder extends XWidgetCreator { |
|
|
|
* @param editingMouseListener 位置处理器 |
|
|
|
* @param editingMouseListener 位置处理器 |
|
|
|
* @return 是否位于可编辑区 |
|
|
|
* @return 是否位于可编辑区 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean mouseEditRangeValid(MouseEvent e, Rectangle rect, EditingMouseListener editingMouseListener) { |
|
|
|
private boolean checkMouseEditRangeValid(MouseEvent e, Rectangle rect, EditingMouseListener editingMouseListener) { |
|
|
|
int minHorizontal = rect.x + rect.width / 2 - editingMouseListener.getMinMoveSize(); |
|
|
|
int horizontalValue = editingMouseListener.getDesigner().getHorizontalScaleValue(); |
|
|
|
int maxHorizontal = rect.x + rect.width / 2 + editingMouseListener.getMinMoveSize(); |
|
|
|
int verticalValue = editingMouseListener.getDesigner().getVerticalScaleValue(); |
|
|
|
int minVertical = rect.y + rect.height / 2 - editingMouseListener.getMinMoveSize(); |
|
|
|
int minMoveSize = editingMouseListener.getMinMoveSize(); |
|
|
|
int maxVertical = rect.y + rect.height / 2 + editingMouseListener.getMinMoveSize(); |
|
|
|
|
|
|
|
|
|
|
|
int minHorizontal = rect.x + rect.width / 2 - minMoveSize - horizontalValue; |
|
|
|
return e.getX() + editingMouseListener.getDesigner().getHorizontalScaleValue() > minHorizontal && e.getX() + editingMouseListener.getDesigner().getHorizontalScaleValue() < maxHorizontal |
|
|
|
int maxHorizontal = rect.x + rect.width / 2 + minMoveSize - horizontalValue; |
|
|
|
&& e.getY() + editingMouseListener.getDesigner().getVerticalScaleValue() > minVertical && e.getY() + editingMouseListener.getDesigner().getVerticalScaleValue() < maxVertical; |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|