@shopware-ag/dive
Version:
Shopware Spatial Framework
54 lines (53 loc) • 1.69 kB
TypeScript
import { Object3D } from 'three/webgpu';
import { DIVEDraggable } from '../../../../index.ts';
import { OrbitController } from '../../../orbitcontroller/index.ts';
import { Tool } from '../Tool.ts';
import { PointerContext } from '../PointerContext.ts';
/**
* Tool for handling drag operations on objects.
*
* Detects DIVEDraggable objects and triggers their drag callbacks.
* Blocks other tools while a drag operation is in progress.
*
* @module
*/
export declare class DragTool implements Tool {
readonly name = "drag";
readonly priority = 10;
private _controller;
private _raycaster;
private _dragging;
private _draggable;
private _dragStart;
private _dragCurrent;
private _dragEnd;
private _dragDelta;
private _dragRaycastTargets;
constructor(controller: OrbitController);
/**
* Whether a drag operation is currently in progress.
*/
get isDragging(): boolean;
/**
* The object currently being dragged, or null.
*/
get draggable(): (Object3D & DIVEDraggable) | null;
onActivate(): void;
onDeactivate(): void;
onPointerDown(ctx: PointerContext): void;
onPointerMove(ctx: PointerContext): boolean | void;
onPointerUp(ctx: PointerContext): void;
/**
* Set custom objects to raycast against during drag.
* Useful for constraining drag to a floor plane.
*
* @param targets Objects to raycast against, or null to use scene objects
*/
setDragRaycastTargets(targets: Object3D[] | null): void;
private startDrag;
private updateDrag;
private endDrag;
private getDragIntersect;
private createDragEvent;
private resetDragState;
}