@logic-pad/core
Version:
26 lines (25 loc) • 1.21 kB
TypeScript
import GridZones from './gridZones.js';
import { Edge, Position } from './primitives.js';
import TileConnections from './tileConnections.js';
export default class GridConnections extends GridZones {
constructor(edges?: readonly Edge[]);
addEdge(edge: Edge): GridConnections;
removeEdge(edge: Edge): GridConnections;
getForTile({ x, y }: Position): TileConnections;
getConnectedTiles({ x, y }: Position): readonly Position[];
/**
* Create new GridConnections from a string array.
*
* - Use `.` for cells that don't connect to anything.
* - Use any other character for cells that connect to the same character.
*
* @param array - The string array to create the connections from.
* @returns The created connections. You can apply this to a GridData object using GridData.withConnections.
*/
static create(array: string[]): GridConnections;
static validateEdges(connections: GridConnections, width: number, height: number): GridConnections;
insertColumn(index: number): GridConnections;
insertRow(index: number): GridConnections;
removeColumn(index: number): GridConnections;
removeRow(index: number): GridConnections;
}