@witchcraft/layout
    Preparing search index...
    • Given an edge or visualEdge (which might touch/contain several frame edges, see getVisualEdges), returns the frame edges that match the given criteria. If no criteria is given, just returns all touching frames.

      Useful, for implementing drag related features.

      A visual explanation of the options:

      frames (A,B,C,D):
      ┌──────────────────┐
      AB
      │ ╏ │
      ├────────╏ │
      C ╏─────────┤
      │ ╏D
      │ ╏ │
      │ < ╏ > searchDirections
      │ ╏ │
      │ + referencePoint*
      │ ╏ │
      └──────────────────┘
      ^visualEdge

      Note the reference point is not on the line. The coordinate used depends on the orientation of the visualEdge.

      So given the middle visual edge, the point + and the right search direction, would return the left edge of frame D.

      Given the left direction instead it would return C.

      Given no point, and the right direction it would return B and D.

      Parameters

      • edge: { endX: number; endY: number; startX: number; startY: number }
      • frames: LayoutFrame[]
      • criteria: {
            referencePoint?: { x: number; y: number };
            searchDirections?: ("up" | "down" | "left" | "right")[];
        } = {}
        • OptionalreferencePoint?: { x: number; y: number }

          If a position (e.g. a cursor position) is given, only edges within the corresponding horizontal/vertical range will be returned.

          For example, if the visual edge is vertical, the function will only return edges that contain the y position, ignoring the x position. See the function documentation for a visual example.

        • OptionalsearchDirections?: ("up" | "down" | "left" | "right")[]

          Several frames can lay to either side of a visual edge. This limits the directions in which to look. Otherwise we look in the directions perpendicular to the visual edge.

          See the function documentation for a visual example.

      Returns {
          edge: { endX: number; endY: number; startX: number; startY: number };
          frame: LayoutFrame;
          side: "left" | "right" | "top" | "bottom";
      }[]