import { RenderManagerBase } from './RenderManagerBase'; import { InstancedMesh, Line, Mesh, Vector3 } from 'three'; export declare enum PickerIntersectionType { None = "line", Face = "face", Point = "point", Line = "line" } interface PickerIntersectionFace { a: Vector3; b: Vector3; c: Vector3; normal: Vector3; } interface PickerIntersection { type: PickerIntersectionType; point: Vector3; distance: number; face?: PickerIntersectionFace; } /** * A Tool for manual user picking points on faces and vertices and finding their coordinates and normal. */ export declare class Picker { private renderManager; private helperSnap; private helper; private isActive; private messageContainer; private readonly viewerElement; /** * Additional objects with picking capability. */ additionalObjects: Set; /** * Whether the selection of elements during picking is locked or not. */ isBlockSelection: boolean; /** * The point on vertex or face from the picking ray. */ rayPoint: Vector3; /** * The normal of the face on which the {@link rayPoint} is located. */ rayFaceNormal: Vector3; /** * The type of active intersection. */ intersectionType: PickerIntersectionType; /** * Is there a intersection with picking ray and vertex or face. */ hasIntersection: boolean; private isStopAtClick; private snapToPoints; private snapToLines; private pickCallback; private endCallback; private beforeEndCallback; private message; /** * @param renderManager - {@link RenderManagerBase} instance. * @param viewerElement - viewer HTML element. */ constructor(renderManager: RenderManagerBase, viewerElement: HTMLElement); private onKeyDown; private onClick; /** * Add callback for 'pick' event. Callback stores only for one picking session called by {@link startPicking}. If callback returns false then 'end' event will chanceled. * @param callback - Callback function. */ onPick(callback: (intersectionType: PickerIntersectionType, rayPoint: Vector3, rayFaceNormal: Vector3) => void): this; private updateMessageContainer; /** * Set optional message for user during the picking process. The message is active only for one picking session called by {@link startPicking}. * @param message - Hint message. */ setMessage(message: string): this; /** * Add callback for end picking event. Callback stores only for one picking session called by {@link startPicking}. * @param callback - Callback function. */ onEnd(callback: (isCanceled: boolean) => void): this; /** * Add callback for end picking event. Callback stores only for one picking session called by {@link startPicking}. * @param callback - Callback function. The callback must return true, false, or undefined. If the callback returns false, the "end picking" operation will be aborted and the picker will remain active. */ onBeforeEnd(callback: (isCanceled: boolean) => boolean | void): this; /** * Starts picking action. * @param blockSelection - Block selection of elements during picking or not. * @param stopAtClick - Stop picking after the first click or continue onward. * @param snapToPoints - Snap to vertices or on faces. * @param snapToLines - Snap to vertices on lines. * @returns Picker instance if picking started successfully or undefined if not. */ startPicking(blockSelection?: boolean, stopAtClick?: boolean, snapToPoints?: boolean, snapToLines?: boolean): Picker | undefined; /** * End picking action. * @param isCanceled - Action result. Will be passed to the callbacks. * @return True if picking has been ended successfully. */ endPicking(isCanceled?: boolean): boolean; private onResize; render(): void; private onMouseWheel; private onMouseMove; private findClosestVertexOnFace; private calculateThresholdFromPoint; private intersectObject; private intersectAdditionalObjects; private intersectOutlineObjects; private intersectSceneObjects; /** * A Get intersection with scene object below mouse coords. */ getSceneIntersection(): PickerIntersection[]; private updateHelperPos; private updateHelperScale; /** * Destroy picker and release all events. */ dispose(): void; } export {};