|
|
|
@ -44,9 +44,7 @@ public class XEditorHolder extends XWidgetCreator {
|
|
|
|
|
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); |
|
|
|
|
editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter); |
|
|
|
|
Rectangle rect = this.getBounds(); |
|
|
|
|
int min = rect.x + rect.width / 2 - editingMouseListener.getMinMoveSize(); |
|
|
|
|
int max = rect.x + rect.width / 2 + editingMouseListener.getMinMoveSize(); |
|
|
|
|
if (e.getX() + editingMouseListener.getDesigner().getHorizontalScaleValue() > min && e.getX() + editingMouseListener.getDesigner().getHorizontalScaleValue() < max) { |
|
|
|
|
if (MouseEditRangeValid(e, rect, editingMouseListener)) { |
|
|
|
|
ToolTipEditor.getInstance().showToolTip((XEditorHolder) this, e.getXOnScreen(), |
|
|
|
|
e.getYOnScreen()); |
|
|
|
|
} |
|
|
|
@ -54,6 +52,24 @@ public class XEditorHolder extends XWidgetCreator {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 判断当前鼠标事件是否在可编辑区域内 |
|
|
|
|
* |
|
|
|
|
* @param e 鼠标事件 |
|
|
|
|
* @param rect 区域 |
|
|
|
|
* @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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected String getIconName() { |
|
|
|
|
return "text_field_16.png"; |
|
|
|
|