Options
All
  • Public
  • Public/Protected
  • All
Menu

Construct a square grid container

Hierarchy

Index

Constructors

Methods

  • Draw the grid. Subclasses are expected to override this method to perform their type-specific drawing logic.

    Parameters

    • options: {} = {}

      Returns SquareGrid

    • _drawLine(points: any, lineColor: any, lineAlpha: any): any
    • Parameters

      • points: any
      • lineColor: any
      • lineAlpha: any

      Returns any

    • getCenter(x: any, y: any): number[]
    • getGridPositionFromPixels(x: any, y: any): number[]
    • getPixelsFromGridPosition(row: any, col: any): number[]
    • getSnappedPosition(x: any, y: any, interval?: number, options?: {}): { x: number; y: number }
    • override

      Parameters

      • x: any
      • y: any
      • interval: number = 1
      • options: {} = {}

        Returns { x: number; y: number }

        • x: number
        • y: number
      • shiftPosition(x: any, y: any, dx: any, dy: any, options?: {}): any
      • Shift a pixel position [x,y] by some number of grid units dx and dy

        Parameters

        • x: any

          The starting x-coordinate in pixels

        • y: any

          The starting y-coordinate in pixels

        • dx: any

          The number of grid positions to shift horizontally

        • dy: any

          The number of grid positions to shift vertically

        • options: {} = {}

          Returns any

        • _getNearestVertex(x: any, y: any): number[]
        • Parameters

          • x: any
          • y: any

          Returns number[]

        • highlightGridPosition(layer: any, options?: {}): void
        • measureDistances(segments: any, options?: {}): any
        • getNeighbors(row: any, col: any): any[][]
        • getTopLeft(x: any, y: any): number[]
        • Given a pair of coordinates (x, y) - return the top-left of the grid square which contains that point

          Parameters

          • x: any
          • y: any

          Returns number[]

          An Array [x, y] of the top-left coordinate of the square which contains (x, y)

        • Determine a placeable's bounding box based on the size of the grid.

          Parameters

          • w: number

            The width in grid spaces.

          • h: number

            The height in grid spaces.

          Returns Rectangle

        • _getRulerDestination(ray: Ray, offset: Point, token: Token): { x: number; y: number }
        • Calculate the resulting token position after moving along a ruler segment.

          internal

          Parameters

          • ray: Ray

            The ray being moved along.

          • offset: Point

            The offset of the ruler's origin relative to the token's position.

          • token: Token

            The token placeable being moved.

          Returns { x: number; y: number }

          • x: number
          • y: number
        • implementationFor(gridType: number): Function
        • Returns the class responsible for the implementation of a given grid type.

          Parameters

          • gridType: number

            The grid type. {@see CONST.GRID_TYPES}

          Returns Function

          (typeof BaseGrid) A constructor for a grid of the given type.

        • calculatePadding(gridType: number, width: number, height: number, size: number, padding: number, options?: { legacy: boolean }): { width: number; height: number; x: number; y: number }
        • Calculate the total size of the canvas with padding applied, as well as the top-left co-ordinates of the inner rectangle that houses the scene.

          Parameters

          • gridType: number

            The grid type to calculate padding for. {@see CONST.GRID_TYPES}

          • width: number

            The width of the scene.

          • height: number

            The height of the scene.

          • size: number

            The grid size.

          • padding: number

            The percentage of padding.

          • options: { legacy: boolean } = {}
            • legacy: boolean

          Returns { width: number; height: number; x: number; y: number }

          • width: number
          • height: number
          • x: number
          • y: number

        Properties

        width: any
        height: any
        options: any
        w: any

        Grid Unit Width

        h: any

        Grid Unit Height