diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/FloatingDecorator.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/FloatingDecorator.java index 4a05faa4a8f0..4a52861a8e64 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/FloatingDecorator.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/FloatingDecorator.java @@ -221,9 +221,11 @@ public final class FloatingDecorator extends JDialog { final Point newPoint=e.getPoint(); SwingUtilities.convertPointToScreen(newPoint,this); final Rectangle screenBounds=WindowManagerEx.getInstanceEx().getScreenBounds(); + int screenMaxX = screenBounds.x + screenBounds.width; + int screenMaxY = screenBounds.y + screenBounds.height; - newPoint.x=Math.min(Math.max(newPoint.x,screenBounds.x),screenBounds.width); - newPoint.y=Math.min(Math.max(newPoint.y,screenBounds.y),screenBounds.height); + newPoint.x = Math.min(Math.max(newPoint.x, screenBounds.x), screenMaxX); + newPoint.y = Math.min(Math.max(newPoint.y, screenBounds.y), screenMaxY); final Rectangle oldBounds=FloatingDecorator.this.getBounds(); final Rectangle newBounds=new Rectangle(oldBounds); @@ -248,16 +250,16 @@ public final class FloatingDecorator extends JDialog { } if((myMotionMask&ANCHOR_BOTTOM)>0){ newPoint.y=Math.max(newPoint.y,oldBounds.y+2*DIVIDER_WIDTH); - if(newPoint.y>screenBounds.height-DIVIDER_WIDTH){ - newPoint.y=screenBounds.height; + if (newPoint.y > screenMaxY - DIVIDER_WIDTH) { + newPoint.y = screenMaxY; } final Point offset=new Point(newPoint.x-myLastPoint.x,newPoint.y-myLastPoint.y); newBounds.height=oldBounds.height+offset.y; } if((myMotionMask&ANCHOR_RIGHT)>0){ newPoint.x=Math.max(newPoint.x,oldBounds.x+2*DIVIDER_WIDTH); - if(newPoint.x>screenBounds.width-DIVIDER_WIDTH){ - newPoint.x=screenBounds.width; + if (newPoint.x > screenMaxX - DIVIDER_WIDTH) { + newPoint.x = screenMaxX; } final Point offset=new Point(newPoint.x-myLastPoint.x,newPoint.y-myLastPoint.y); newBounds.width=oldBounds.width+offset.x;