sesaparcours
    Preparing search index...

    Type Alias ConstrainFunction

    ConstrainFunction: (
        desiredLoc: PointXY,
        dragEl: HTMLElement,
        constrainRect: Size,
        size: Size,
        e: MouseEvent,
    ) => PointXY

    Definition of a function that can be used to constrain the movemement of an element that is being dragged. The function is given the "desiredLoc", which is the location the element would be moved to if not constrained, and it is expected to return either some other value, meaning place the element at that position, or null, meaning for the given desired location there is no preferred position and the element should not be moved.

    Type Declaration

      • (
            desiredLoc: PointXY,
            dragEl: HTMLElement,
            constrainRect: Size,
            size: Size,
            e: MouseEvent,
        ): PointXY
      • Parameters

        • desiredLoc: PointXY

          Position the element will be placed at if unconstrained

        • dragEl: HTMLElement

          the element that is being dragged

        • constrainRect: Size

          The size of any parent drag area

        • size: Size

          The size of the element being dragged

        • e: MouseEvent

          The mouse event associated with this tick of the drag lifecycle.

        Returns PointXY