@shopware-ag/dive
Version:
Shopware Spatial Framework
44 lines (43 loc) • 1.36 kB
TypeScript
import { Object3D } from 'three/webgpu';
import { DIVESelectable } from '../../../index.ts';
type SelectionChangeCallback = (selected: (Object3D & DIVESelectable) | null) => void;
/**
* Manages selection state and notifies listeners on changes.
*
* Provides a centralized way to track what object is currently selected
* and allows tools like TransformTool to react to selection changes.
*
* @module
*/
export declare class SelectionState {
private _selected;
private _listeners;
/**
* Currently selected object, or null if nothing is selected.
*/
get selected(): (Object3D & DIVESelectable) | null;
/**
* Select an object. Deselects any previously selected object.
* Calls onSelect on the new object and onDeselect on the previous.
*/
select(obj: Object3D & DIVESelectable): void;
/**
* Deselect the currently selected object.
* Calls onDeselect on the object.
*/
deselect(): void;
/**
* Register a callback to be notified when selection changes.
*/
onChange(callback: SelectionChangeCallback): void;
/**
* Unregister a previously registered callback.
*/
offChange(callback: SelectionChangeCallback): void;
/**
* Dispose of the selection state and clear all listeners.
*/
dispose(): void;
private notifyListeners;
}
export {};