private MouseTarget findTargetLayout(final double x,
                                         final double y,
                                         final boolean splitter,
                                         final LayoutConfig layoutConfig,
                                         final PositionAndSize positionAndSize,
                                         final boolean selecting) {
        final double width = positionAndSize.getWidth();
        final double height = positionAndSize.getHeight();
        final double left = ElementUtil.getClientLeft(designSurfaceElement) + positionAndSize.getLeft();
        final double right = left + width;
        final double top = ElementUtil.getClientTop(designSurfaceElement) + positionAndSize.getTop();
        final double bottom = top + height;

        // Splitters activate outside their rect so a border is added for
        // activation.
        double border = 0;
        if (splitter) {
            border = OUTER_SPLIT_BOUNDARY;
        }

        // First see if the mouse is even over the layout.
        if (x >= left - border && x <= right + border && y >= top - border && y <= bottom + border) {
            if (!splitter) {
                // If this isn't a splitter then test if the mouse is over a tab.
                final MouseTarget mouseTarget = findTargetTab(
                        x,
                        y,
                        (TabLayoutConfig) layoutConfig,
                        positionAndSize,
                        selecting);
                if (mouseTarget != null) {
                    return mouseTarget;
                }
            }

            final double xDiff = Math.min(x - left, right - x);
            final double yDiff = Math.min(y - top, bottom - y);
            double activeWidth = OUTER_SPLIT_BOUNDARY;
            double activeHeight = OUTER_SPLIT_BOUNDARY;

            if (!splitter) {
                activeWidth = width / 3;
                activeHeight = height / 3;
            }

            Pos pos = Pos.CENTER;

            if (x <= left + activeWidth) {
                pos = Pos.LEFT;
            } else if (x >= right - activeWidth) {
                pos = Pos.RIGHT;
            }

            if (y <= top + activeHeight) {
                if (pos == Pos.LEFT || pos == Pos.RIGHT) {
                    if (yDiff < xDiff) {
                        pos = Pos.TOP;
                    }
                } else {
                    pos = Pos.TOP;
                }
            } else if (y >= bottom - activeHeight) {
                if (pos == Pos.LEFT || pos == Pos.RIGHT) {
                    if (yDiff < xDiff) {
                        pos = Pos.BOTTOM;
                    }
                } else {
                    pos = Pos.BOTTOM;
                }
            }

            if (pos == Pos.CENTER && splitter) {
                return null;
            }

            return new MouseTarget(
                    layoutConfig,
                    positionAndSize,
                    pos,
                    null,
                    null,
                    null,
                    -1,
                    null);
        }

        return null;
    }
Tests the supplied layout to see if it is the current mouse target and
returns mouse target if it is.

@param x               The mouse x coordinate.
@param y               The mouse y coordinate.
@param splitter        True if the layout is a splitter. Splitters are targeted
                       outside their rect.
@param layoutConfig    The layout data to test to see if it is a target.
@param positionAndSize The position and size of the layout being tested.
@return The mouse target if the tested layout is the target, else null.
stroom-core-client/src/main/java/stroom/dashboard/client/flexlayout/FlexLayout.java