import { Object3D, Scene } from 'three'; import { Cursor } from '../events/CursorManager.js'; import { Events, InteractionEvents } from '../events/Events.js'; import { Hitbox } from '../events/Hitbox.js'; import { Tween } from '../tweening/Tween.js'; /** * Represents the prototype for extended Object3D functionality. */ export interface Object3DExtPrototype { /** * Determines if the object is enabled. Default is `true`. * If set to true, it allows triggering all InteractionEvents; otherwise, events are disabled. */ enabled: boolean; /** * Determines if the **object** and **all of its children** can be intercepted by the main raycaster. * @default DEFAULT_INTERCEPT_BY_RAYCASTER (true). */ interceptByRaycaster: boolean; /** Array of hitboxes for collision detection. */ hitboxes: Hitbox[]; /** Indicates which object will be dragged instead of this one. */ dragTarget: Object3D; /** Indicates whether the object can receive focus. Default is DEFAULT_FOCUSABLE (`true`). */ focusable: boolean; /** Indicates whether the object is draggable. Default is DEFAULT_DRAGGABLE (`false`). */ draggable: boolean; /** Determines when the object is dragged, whether it will have to search for any drop targets. Default is `false`. */ findDropTarget: boolean; /** Reference to the scene the object belongs to. */ scene: Scene; /** Cursor style when interacting with the object. */ cursor: Cursor; /** Cursor style when dragging the object. */ cursorDrag: Cursor; /** Cursor style when dropping an object onto this one. */ cursorDrop: Cursor; /** Indicates whether the scene needs rendering. */ needsRender: boolean; /** Indicates the tags to be searched using the querySelector and `querySelectorAll` methods. */ tags: Set; /** Indicates if the primary pointer is over this object. */ get hovered(): boolean; /** Indicates if the object is currently focused. */ get focused(): boolean; /** Indicates if the object is currently being clicked. */ get clicking(): boolean; /** Indicates if the object is currently being dragged. */ get isDragging(): boolean; /** Retrieves the combined enabled state considering parent objects. */ get enabledState(): boolean; /** Retrieves the combined visibility state considering parent objects. */ get visibilityState(): boolean; /** Retrieves the first possible focusable object. */ get firstFocusable(): Object3D; /** * Applies focus to the object. */ applyFocus(): void; /** * Applies blur (removes focus) from the object. */ applyBlur(): void; /** * Attaches an event listener to the object. * @param type - The type of event to listen for. * @param listener - The callback function to execute when the event occurs. * @returns A function to remove the event listener. */ on(type: K | K[], listener: (this: this, event?: Events[K]) => void): (event?: Events[K]) => void; /** * Checks if the object has a specific event listener. * @param type - The type of event to check for. * @param listener - The callback function to check. * @returns `true` if the event listener is attached; otherwise, `false`. */ hasEvent(type: K, listener: (event?: Events[K]) => void): boolean; /** * Removes an event listener from the object. * @param type - The type of event to remove the listener from. * @param listener - The callback function to remove. */ off(type: K, listener: (event?: Events[K]) => void): void; /** * Triggers a specific event on the object. * @param type - The type of event to trigger. * @param event - Optional event data to pass to the listeners. */ trigger(type: K, event?: Events[K]): void; /** * Triggers a specific event on the object and all its ancestors. * @param type - The type of event to trigger. * @param event - Optional event data to pass to the listeners. */ triggerAncestor(type: K, event?: InteractionEvents[K]): void; /** * Activates manual detection mode for bindings. * When this method is used, all bindings will no longer be calculated automatically. * Instead, they must be manually computed using the 'detectChanges' function. */ setManualDetectionMode(): void; /** * Calculates all bindings on the current object. * If 'recursive' is set to true, it will also calculate bindings for all children. * @param recursive If true, calculate bindings for children as well (optional, default: `false`). */ detectChanges(recursive?: boolean): void; /** * Binds a property to a callback function for updates. * @param property - The name of the property to bind. * @param getCallback - A function that retrieves the property's value. * @param renderOnChange - Indicates whether to render when the property changes (optional, default: `false`). * @returns The instance of the object with the binding applied. */ bindProperty(property: T, getCallback: () => this[T], renderOnChange?: boolean): this; /** * Unbinds a previously bound property from the object. * @param property - The name of the property to unbind. * @returns The instance of the object with the binding removed. */ unbindProperty(property: T): this; /** * Initiates a Tween animation for the object. * @param id - Unique identifier. If you start a new tween, the old one with the same id (if specified) will be stopped. * @template T - The type of the target. * @returns A Tween instance for further configuration. */ tween(id?: string): Tween; /** * Finds and returns the first Object3D element that matches the specified query string. * This method follows a similar syntax to CSS selectors. * @param query - The query string to match against the Object3D elements. * @returns The first Object3D element that matches the query, or undefined if no match is found. */ querySelector(query: string): Object3D; /** * Finds and returns a list of Object3D elements that match the specified query string. * This method follows a similar syntax to CSS selectors. * @param query - The query string to match against the Object3D elements. * @returns An array of Object3D elements that match the query. */ querySelectorAll(query: string): Object3D[]; } //# sourceMappingURL=Object3D.d.ts.map