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 , _context: MaterialContext ): Partial , _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 , context: MaterialContext ): unknown;
}