UNPKG

@shopware-ag/dive

Version:

Shopware Spatial Framework

73 lines (72 loc) 2.08 kB
import { DIVEScene } from '../../../index.ts'; import { OrbitController } from '../../orbitcontroller/index.ts'; import { Tool } from './Tool.ts'; import { SelectionState } from './SelectionState.ts'; import { ToolType, ToolTypeMap } from '../types/index.ts'; /** * Toolbox manages multiple tools and dispatches pointer events to them. * * Tools are processed in priority order (lower number = higher priority). * Each tool can stop event propagation by returning true from its handler. * * @module */ export declare class Toolbox { private _scene; private _controller; private _canvas; private _tools; private _activeTools; private _sortedActiveTools; private _selectionState; get selectionState(): SelectionState; private _raycaster; private _pointer; private _productLayerMask; private _uiLayerMask; private _pointerPrimaryDown; private _pointerMiddleDown; private _pointerSecondaryDown; private _lastPointerDown; private _boundPointerMove; private _boundPointerDown; private _boundPointerUp; private _boundWheel; constructor(scene: DIVEScene, controller: OrbitController); /** * Enable a tool by type. */ enableTool(type: ToolType): void; /** * Disable an active tool by type. */ disableTool(type: ToolType): void; /** * Check if a tool is currently enabled. */ isToolEnabled(type: ToolType): boolean; /** * Get a tool by type. */ getTool<T extends ToolType>(type: T): ToolTypeMap[T]; /** * Get all currently active tools. */ getActiveTools(): Tool[]; /** * Dispose of the toolbox and clean up resources. */ dispose(): void; private onPointerMove; private onPointerDown; private onPointerUp; private onWheel; private createPointerContext; private createWheelContext; private updatePointer; private updatePointerState; private raycast; private filterIntersectsByLayer; private updateSortedTools; private pointerWasDragged; }