• Snap the given x,y to a point on the grid defined by gridX and gridY, using the given thresholds to calculate proximity to the grid.

    Parameters

    • pos: PointXY

      Position to transform

    • grid: Grid

      Definition of the grid

    • Optional thresholdX: number

      Defines how close to a grid line in the x axis a value must be in order to be snapped to it.

    • Optional thresholdY: number

      Defines how close to a grid line in the y axis a value must be in order to be snapped to it.

    Returns PointXY

    The point to which the position was snapped, given the constraints of the grid.

Version :