import { Coordinates, Location, MaterialItem, MoveItem, Polyomino, XYCoordinates } from '@gamepark/rules-api'; import { LocationDescription } from '../components'; import { ItemContext, Locator, MaterialContext } from './Locator'; /** * This locator is responsible for placing locations and items on a square grid (for Polyominoes). */ export declare abstract class SquareGridLocator

extends Locator { /** * The size of one square cell (width and height, in em). For non-square cells, the size can use XY values. */ abstract size: number | XYCoordinates; /** * Horizontal size of a cell */ protected get sizeX(): number; /** * Vertical size of a cell */ protected get sizeY(): number; /** * Polyomino of the drop area */ dropArea?: Polyomino; /** * Override if you need a dynamic drop area * @param _location The location to consider * @param _context Context of the game * @return the current drop area */ getDropArea(_location: Location, _context: MaterialContext): Polyomino | undefined; /** * Get the coordinates for the full grid area * @param location Location to place * @param context Context of the game * @returns The coordinates of the area */ getAreaCoordinates(location: Location, context: MaterialContext): Partial; /** * Get the coordinates of a location on the grid * @param location Location to place * @param context Context of the game * @return the coordinates */ getLocationCoordinates(location: Location, context: MaterialContext): Partial; /** * Get the position of a square cell * @param coordinates Coordinates of the cell * @return coordinates to place the cell on the location */ getSquarePosition(coordinates: Partial): XYCoordinates; /** * Get the coordinates of an item on the grid. If the item is a Polyomino, the shape will be used to center the origin coordinates of the item on the * correct grid location. * @param item Item to place * @param context Context of the game * @return the coordinates of the item */ getItemCoordinates(item: MaterialItem, context: ItemContext): Partial; /** * Rotate the location. On a square grid, by default the rotation is expected to be [0, 3] and it is multiplied by 90 degrees. * @param location Location to rotate * @param _context Context of the item * @return the location's rotation in degrees */ getRotateZ(location: Location, _context: MaterialContext): number; /** * Returns the drop locations for current dragged item. The square grid must be one simple drop location. */ getDropLocations(moves: MoveItem[], context: ItemContext): Location[]; dropPreview: boolean; /** * Generate automatically a {@link SquareGridDropAreaDescription} based on the grid boundaries */ getLocationDescription(location: Location, context: MaterialContext | ItemContext): LocationDescription | undefined; /** * Compute the boundaries of a polyomino, in em (relative to the grid origin). Empty cells on the edges are ignored. * @param polyomino The polyomino to measure * @return the boundaries in em */ getBoundaries(polyomino: Polyomino): { xMin: number; xMax: number; yMin: number; yMax: number; }; }