import { Coordinates, Location } from '@gamepark/rules-api'; import { Locator, MaterialContext } from './Locator'; /** * Boundaries of items on the grid, in grid coordinates (not em). */ export type GridBoundaries = { xMin: number; xMax: number; yMin: number; yMax: number; }; /** * Dimensions of the visible grid window, in cells. */ export type GridSize = { columns: number; rows: number; }; /** * This Locator places items on a rectangular grid with automatic panning. * * Items are positioned using their `location.x` and `location.y` as grid coordinates. * The gap between cells is defined by {@link gap} (in em). * * When a {@link gridSize} is provided, the locator maintains a stable visible window: * as long as all items fit inside, nothing moves. When items exceed the window, * the view recenters on the barycentre. * * Without {@link gridSize}, the grid always centers on the barycentre of the items. * * Multiple independent grids are supported via {@link getGridId}, following the same * pattern as {@link PileLocator.getPileId}. * * Override {@link getBoundaries} to provide custom boundaries (e.g. from a game helper). */ export declare class GridLocator

extends Locator { constructor(clone?: Partial); /** * The gap between two consecutive grid cells, in em. */ gap?: Partial; /** * Function to override to provide a {@link gap} that depends on the context. * @param _location Location to position * @param _context Context of the game * @returns The gap between two consecutive grid cells */ getGap(_location: Location, _context: MaterialContext): Partial; /** * The size of the visible grid window, in cells. * When items fit inside the window, the view does not move. * When items exceed it, the view recenters on the barycentre. * Without gridSize, the view always centers on the barycentre. */ gridSize?: GridSize; /** * Function to override to provide a {@link gridSize} that depends on the context. * @param _location Location to position * @param _context Context of the game * @returns The grid size */ getGridSize(_location: Location, _context: MaterialContext): GridSize | undefined; /** * Identifier for the grid. By default, distinct location areas (different player, id or parent) form distinct grids. * @param location Location in the grid * @param _context Context of the game * @returns A unique identifier for the grid this location belongs to */ getGridId(location: Location, _context: MaterialContext): string; /** * Compute the boundaries of all items on this grid, in grid coordinates. * Override this to provide custom boundaries (e.g. from a game helper). * * Default implementation scans all item types placed by this locator. * * @param location A location in the grid area * @param context Context of the game * @returns The grid boundaries, or undefined if no items exist */ getBoundaries(location: Location, context: MaterialContext): GridBoundaries | undefined; private deltas; private game?; private refreshedGrids; private refreshDelta; private ensureRefreshed; getCoordinates(location: Location, context: MaterialContext): Partial; getPositionDependencies(location: Location, context: MaterialContext): unknown; }