import * as THREE from "three"; import type { Theme } from "../core/types"; import type { BoundingBox } from "./bbox.js"; interface GridOptions { bbox: BoundingBox; ticks?: number; gridFontSize: number; centerGrid?: boolean; axes0?: boolean; grid: [boolean, boolean, boolean]; flipY?: boolean; theme: Theme; cadWidth: number; height: number; maxAnisotropy: number; tickValueElement?: HTMLElement; tickInfoElement?: HTMLElement; getCamera: () => THREE.OrthographicCamera | THREE.PerspectiveCamera | null; getAxes0: () => boolean; onGridChange?: (allGrid: boolean, grids: [boolean, boolean, boolean]) => void; } /** * Grid component for displaying coordinate grids in 3D space. * Supports XY, XZ, and YZ plane grids with labeled tick marks. */ declare class Grid extends THREE.Group { ticks: number; ticks0: number; gridFontSize: number; bbox: BoundingBox; centerGrid: boolean; axes0: boolean; grid: [boolean, boolean, boolean]; allGrid: boolean; theme: Theme; flipY: boolean; lastZoomIndex: number; lastFontIndex: number; cadWidth: number; height: number; maxAnisotropy: number; tickValue: HTMLElement | null; info: HTMLElement | null; getCamera: () => THREE.OrthographicCamera | THREE.PerspectiveCamera | null; getAxes0: () => boolean; onGridChange: ((allGrid: boolean, grids: [boolean, boolean, boolean]) => void) | null; minFontIndex: number; minZoomIndex: number; zoomMaxIndex: number; canvasHeight: number; size: number; delta: number; geomCache: Record; textureAspectRatios: Record; labelCache: Record; materialCache: Record; colors: Record; /** * Create a Grid instance * @param options - Configuration options */ constructor(options: GridOptions); /** * Calculate text scale based on camera mode and canvas size */ private calculateTextScale; /** * Update scale of all grid labels */ scaleLabels(): void; /** * Show or hide all grid labels */ private showLabels; /** * Update grid based on zoom level * @param zoom - Current zoom level * @param force - Force update regardless of zoom change * @param theme - Optional new theme to apply */ update(zoom: number, force?: boolean, theme?: Theme | null): Promise; /** * Create the grid geometry and labels * @param nice - Whether to use nice bounds calculation */ create(nice?: boolean): Promise; /** * Create a text texture for grid labels */ private createTextTexture; /** * Create a label sprite for grid axis */ private createLabel; /** * Calculate nice symmetric grid bounds centered at zero */ private niceBounds; /** * Compute grid visibility and notify UI */ computeGrid(): void; /** * Toggle grid visibility by action * @param action - Action type ("grid", "grid-xy", "grid-xz", "grid-yz") * @param flag - Optional explicit flag for "grid" action */ setGrid(action: string, flag?: boolean | null): void; /** * Set grid visibility for all planes * @param xy - XY plane visibility * @param xz - XZ plane visibility * @param yz - YZ plane visibility */ setGrids(xy: boolean, xz: boolean, yz: boolean): void; /** * Set grid center position * @param axes0 - Whether to center at origin * @param flipY - Whether Y axis is flipped */ setCenter(axes0: boolean, flipY: boolean): void; /** * Update visibility of grid planes and tick info */ setVisible(): void; /** * Update tick info display */ private setTickInfo; /** * Get overall grid visibility * @returns Whether any grid plane is visible */ getVisible(): boolean; /** * Clear all caches (textures, materials, labels) */ clearCache(): void; /** * Dispose all resources */ dispose(): void; } export { Grid };