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