@ -166,7 +166,7 @@ public class EditingMouseListener extends MouseInputAdapter {
// 获取焦点,以便获取热键
designer . requestFocus ( ) ;
}
if ( e . getButton ( ) = = MouseEvent . BUTTON1 ) {
if ( e . getButton ( ) = = MouseEvent . BUTTON1 & & ! beyondValidArea ( e ) ) {
Direction dir = selectionModel . getDirectionAt ( e ) ;
if ( ! DesignerMode . isAuthorityEditing ( ) ) {
@ -177,13 +177,11 @@ public class EditingMouseListener extends MouseInputAdapter {
if ( designer . isDrawLineMode ( ) ) {
designer . updateDrawLineMode ( e ) ;
} else {
int relativeX = Math . max ( 0 , e . getX ( ) ) ;
int relativeY = Math . max ( 0 , e . getY ( ) ) ;
if ( selectionModel . hasSelectionComponent ( )
& & selectionModel . getSelection ( ) . getRelativeBounds ( ) . contains (
designer . getHorizontalScaleValue ( ) + relativeX ,
designer . getVerticalScaleValue ( ) + relativeY ) ) {
designer . getHorizontalScaleValue ( ) + e . getX ( ) ,
designer . getVerticalScaleValue ( ) + e . getY ( ) ) ) {
lastPressEvent = e ;
lastXCreator = selectionModel . getSelection ( ) . getSelectedCreator ( ) ;
} else {
@ -197,6 +195,16 @@ public class EditingMouseListener extends MouseInputAdapter {
e . translatePoint ( oldX - e . getX ( ) , oldY - e . getY ( ) ) ;
}
private boolean beyondValidArea ( MouseEvent e ) {
if ( e . getX ( ) < 0 | | e . getY ( ) < 0 | |
e . getX ( ) > designer . getRootComponent ( ) . getWidth ( ) | |
e . getY ( ) > ( designer . getRootComponent ( ) . getHeight ( ) + designer . getParaHeight ( ) ) ) {
return true ;
}
return false ;
}
private void offsetEventPoint ( MouseEvent e ) {
int x = designer . getRelativeX ( e . getX ( ) ) ;
int y = designer . getRelativeY ( e . getY ( ) ) ;