import * as THREE from "three"; import { DistanceMeasurement, PropertiesMeasurement } from "./measure.js"; import { SelectObject } from "./select.js"; import type { PickedObject } from "../../rendering/raycast.js"; /** * Enum representing tool types. */ export declare const ToolTypes: { readonly NONE: "None"; readonly DISTANCE: "DistanceMeasurement"; readonly PROPERTIES: "PropertiesMeasurement"; readonly SELECT: "SelectObjects"; }; export type ToolType = (typeof ToolTypes)[keyof typeof ToolTypes]; /** * UI elements for measurement panels. */ export interface MeasurementPanelElements { distancePanel: HTMLElement; propertiesPanel: HTMLElement; } /** * UI elements for the shape filter dropdown. */ export interface FilterDropdownElements { container: HTMLElement; dropdown: HTMLElement; icon: HTMLElement; value: HTMLElement; content: HTMLElement; options: { none: HTMLElement; vertex: HTMLElement; edge: HTMLElement; face: HTMLElement; solid: HTMLElement; }; } /** * Minimal display interface for CAD tools. */ export interface DisplayLike { container: HTMLElement; shapeFilterDropDownMenu: { reset(): void; }; /** UI elements for measurement panels */ measurementPanels: MeasurementPanelElements; /** UI elements for filter dropdown */ filterDropdown: FilterDropdownElements; } /** * Minimal viewer interface for CAD tools. * Used by measurement, selection, and zebra tools. */ export interface ViewerLike { display: DisplayLike; renderer: THREE.WebGLRenderer; camera: { getCamera(): THREE.Camera; getZoom(): number; } | null; state: { get(key: string): unknown; }; ortho: boolean; bb_radius: number; checkChanges(changes: Record, notify?: boolean): void; } export interface ToolResponse { tool_type: ToolType; [key: string]: unknown; } export declare class Tools { viewer: ViewerLike; distanceMeasurement: DistanceMeasurement; propertiesMeasurement: PropertiesMeasurement; selectObject: SelectObject; enabledTool: ToolType | null; constructor(viewer: ViewerLike, debug: boolean); /** * Enables a specific tool. (Disables the currently enabled tool if any) */ enable(toolType: ToolType): void; disable(): void; /** * Disables the currently enabled tool. */ _disable(): void; handleRemoveLastSelection(force?: boolean): void; /** * Handle selected object from raycaster. */ handleSelectedObj(selectedObj: PickedObject, isNewObject: boolean, shift: boolean): void; handleResetSelection(): void; /** * Handle the response from the backend. */ handleResponse(response: ToolResponse): void; /** * This is called each time the viewer gets updated */ update(): void; dispose(): void; }