import { Box3, BufferGeometry, Color, Material, Mesh, Raycaster, Vector2, type Intersection } from 'three'; import { AnchorX, AnchorY, Text } from 'troika-three-text'; import SpeckleBasicMaterial, { BillboardingType } from '../materials/SpeckleBasicMaterial.js'; import SpeckleTextMaterial from '../materials/SpeckleTextMaterial.js'; import { ObjectLayers } from '../../index.js'; export interface TextLabelParams { text?: string; fontSize?: number; maxWidth?: number; anchorX?: AnchorX; anchorY?: AnchorY; billboard?: BillboardingType | null; backgroundColor?: Color | null; backgroundCornerRadius?: number; backgroundMargins?: Vector2; textColor?: Color; textOpacity?: number; objectLayer?: ObjectLayers; } /** Screen */ export declare const DefaultTextLabelParams: Required; export declare class TextLabel extends Text { /** Needs a raycast to start rendering */ private readonly DEBUG_BILLBOARDS; material: SpeckleTextMaterial; private _background; private _backgroundMaterial; private _params; private _textBounds; private _collisionMesh; get textMesh(): this; get backgroundMesh(): Mesh; get textBounds(): Box3; get backgroundMaterial(): SpeckleBasicMaterial; constructor(params?: TextLabelParams); updateParams(params: TextLabelParams, onUpdateComplete?: () => void): Promise; raycast(raycaster: Raycaster, intersects: Array): void; /** Gets the current bounds reported by troika taking `fontSize` into account */ private textBoundsToBox; /** Text's blockBounds, the one we're working with bounds-wise is not a unit quad When using BILLBOARD_SCREEN we store the desired pixel size in the text's `fontSize` property This makes troika compute a large text since it thinks our pixels are world units. So we divide the text bounds by the font size to get the size of the unit text bounds, or another way of putting it, to compute the text bounds value as if fontSize = 1 From the unit box, we get it's size and compute a world->pixel ratio which we send to the shader */ private updateBillboarding; private updateBackground; /** Improved version of https://discourse.threejs.org/t/roundedrectangle-squircle/28645 by way of the vibe */ private RectangleRounded; }