boolean (@NotNull Point screenPoint) { Point point = screenPoint.getLocation(); SwingUtilities.convertPointFromScreen(point, isVisible() ? this : getParent()); int width = getWidth(); int height = getHeight(); if (!isVisible()) { Rectangle bounds = ClientProperty.get(this, VIRTUAL_BOUNDS); if (bounds != null) { point.x -= bounds.x; point.y -= bounds.y; width = bounds.width; height = bounds.height; } } int areaSize = Math.min(Math.min(getParent().getWidth() / 2, getParent().getHeight() / 2), JBUI.scale(DROP_DISTANCE_SENSITIVITY)); Point[] points = {new Point(0, 0), new Point(width, 0), new Point(width, height), new Point(0, height)}; switch (anchor) { //Top area should be is empty due to IDEA-271100 case SwingConstants.TOP -> { updateLocation(points, 1, 2, 0, 0, areaSize); updateLocation(points, 0, 3, 0, 0, areaSize); } case SwingConstants.LEFT -> { updateLocation(points, 0, 1, 1, 0, areaSize); updateLocation(points, 3, 2, 1, -1, areaSize); } case SwingConstants.BOTTOM -> { updateLocation(points, 3, 0, 1, -1, areaSize); updateLocation(points, 2, 1, -1, -1, areaSize); } case SwingConstants.RIGHT -> { updateLocation(points, 1, 0, -1, 0, areaSize); updateLocation(points, 2, 3, -1, 1, areaSize); } } return new Polygon(new int[]{points[0].x, points[1].x, points[2].x, points[3].x}, new int[]{points[0].y, points[1].y, points[2].y, points[3].y}, 4).contains(point); }