From ea4ce1c23fcc6e2fdf86fc9e4da8f1f493db82f2 Mon Sep 17 00:00:00 2001 From: Mari Date: Thu, 8 Jul 2021 22:25:54 -0400 Subject: [PATCH] Rename cells_per_line to cellsPerLine for consistency. --- client/src/App.tsx | 2 +- client/src/state/HexMap.ts | 10 +++++----- client/src/ui/HexMapRenderer.tsx | 2 +- client/src/ui/debug/ConsoleConnection.tsx | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index f72a256..ecaa079 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -38,7 +38,7 @@ function App() { } : null), [map]) const mapElement = !!offsets && !!map ? : null; const {width, height} = useMemo(() => !!offsets && !!map ? sizeFromLinesAndCells({ - bottomMargin: 10, cells: map.cells_per_line, lines: map.lines, offsets: offsets, rightMargin: 10 + bottomMargin: 10, cells: map.cellsPerLine, lines: map.lines, offsets: offsets, rightMargin: 10 }) : {width: 1, height: 1}, [map, offsets]); const colorPickerElement = !!user ? dispatch({ type: USER_ACTIVE_COLOR, diff --git a/client/src/state/HexMap.ts b/client/src/state/HexMap.ts index c2e38d9..eecb21e 100644 --- a/client/src/state/HexMap.ts +++ b/client/src/state/HexMap.ts @@ -56,7 +56,7 @@ export interface HexMap { * In ROWS and EVEN_ROWS mode, this is the width of the map. * In COLUMNS and EVEN_COLUMNS mode, this is the height of the map. */ - readonly cells_per_line: number + readonly cellsPerLine: number /** * The list of tile lines. There are always exactly {lines} lines. * Lines have a constant length; there are always exactly {cells_per_line} cells in a line. @@ -71,10 +71,10 @@ export interface HexMap { readonly xid: string } -export function initializeMap({lines, cells_per_line, displayMode, xid}: {lines: number, cells_per_line: number, displayMode: HexMapRepresentation, xid: string}): HexMap { +export function initializeMap({lines, cellsPerLine, displayMode, xid}: {lines: number, cellsPerLine: number, displayMode: HexMapRepresentation, xid: string}): HexMap { const lineCells: HexLine[] = []; const emptyLine: HexCell[] = []; - for (let cell = 0; cell < cells_per_line; cell += 1) { + for (let cell = 0; cell < cellsPerLine; cell += 1) { emptyLine.push(EMPTY_CELL) } for (let line = 0; line < lines; line += 1) { @@ -82,7 +82,7 @@ export function initializeMap({lines, cells_per_line, displayMode, xid}: {lines: } return { lines, - cells_per_line, + cellsPerLine: cellsPerLine, displayMode, lineCells, xid @@ -91,7 +91,7 @@ export function initializeMap({lines, cells_per_line, displayMode, xid}: {lines: export function isValidCoordinate(map: HexMap, {line, cell}: StorageCoordinates) { return line >= 0 && line < map.lines && Number.isInteger(line) - && cell >= 0 && cell < map.cells_per_line && Number.isInteger(cell); + && cell >= 0 && cell < map.cellsPerLine && Number.isInteger(cell); } export function areCellsEquivalent(left: HexCell|null, right: HexCell|null): boolean { diff --git a/client/src/ui/HexMapRenderer.tsx b/client/src/ui/HexMapRenderer.tsx index 4194d30..1a211be 100644 --- a/client/src/ui/HexMapRenderer.tsx +++ b/client/src/ui/HexMapRenderer.tsx @@ -6,7 +6,7 @@ import {RenderOffsets, storageCoordinatesToKey} from "../state/Coordinates"; function HexMapRenderer({map, offsets}: {map: HexMap, offsets: RenderOffsets}) { const tiles: ReactElement[] = []; for (let line = 0; line < map.lines; line += 1) { - for (let cell = 0; cell < map.cells_per_line; cell += 1) { + for (let cell = 0; cell < map.cellsPerLine; cell += 1) { const coords = {line, cell}; const cellData = getCell(map, coords); if (cellData !== null) { diff --git a/client/src/ui/debug/ConsoleConnection.tsx b/client/src/ui/debug/ConsoleConnection.tsx index 5e99f39..3062918 100644 --- a/client/src/ui/debug/ConsoleConnection.tsx +++ b/client/src/ui/debug/ConsoleConnection.tsx @@ -88,7 +88,7 @@ export class ConsoleConnection { state: { map: initializeMap({ lines, - cells_per_line: cells, + cellsPerLine: cells, displayMode: orientationFromString(displayMode), xid }),