import { ContextManager, ConstructorProps, Observable, Event } from '@zcomponent/core'; import { Group } from '../Group'; /** * Defines the anchor point from which scale is applied. */ export declare const GestureTransformScaleOrigin: { /** Scale from the object's local origin (default). */ readonly Center: "Center"; /** Scale from the bottom of the bounding box so it stays planted on the ground. */ readonly Bottom: "Bottom"; }; export type GestureTransformScaleOrigin = (typeof GestureTransformScaleOrigin)[keyof typeof GestureTransformScaleOrigin]; /** * Defines how one-finger drag translates the object. */ export declare const GestureTransformDragPlane: { /** Project movement onto a plane perpendicular to the camera*/ readonly Camera: "Camera"; /** Project movement onto the ground (XZ) plane */ readonly Ground: "Ground"; }; export type GestureTransformDragPlane = (typeof GestureTransformDragPlane)[keyof typeof GestureTransformDragPlane]; /** * Defines the action performed by a one-finger drag gesture. */ export declare const OneFingerDragAction: { /** Translate the object on the drag plane. */ readonly Move: "Move"; /** Rotate the object around the Y axis. */ readonly Rotate: "Rotate"; /** One-finger drag is disabled. */ readonly None: "None"; }; export type OneFingerDragAction = (typeof OneFingerDragAction)[keyof typeof OneFingerDragAction]; /** * Defines the action performed by a two-finger pinch/twist gesture. */ export declare const TwoFingerPinchAction: { /** Rotate around the Y axis. */ readonly Rotate: "Rotate"; /** Uniform scale. */ readonly Scale: "Scale"; /** Rotate and scale simultaneously. */ readonly RotateAndScale: "Rotate and Scale"; /** Two-finger gestures are disabled. */ readonly None: "None"; }; export type TwoFingerPinchAction = (typeof TwoFingerPinchAction)[keyof typeof TwoFingerPinchAction]; /** * Defines the action performed by the scroll wheel. */ export declare const ScrollWheelAction: { /** Scale the object. */ readonly Scale: "Scale"; /** Rotate the object around the Y axis. */ readonly Rotate: "Rotate"; /** Scroll wheel is disabled. */ readonly None: "None"; }; export type ScrollWheelAction = (typeof ScrollWheelAction)[keyof typeof ScrollWheelAction]; /** * GestureTransform allows users to translate, rotate, and scale its children using touch/pointer gestures. * * - One-finger drag: translate on a plane * - Two-finger pinch: uniform scale * - Two-finger twist: rotate around Y axis * - Pinch and twist work simultaneously * * Does not run during design time. * * * Root element: [THREE.Group](https://threejs.org/docs/index.html#api/en/objects/Group) * * @zcomponent * @ztag three/Object3D/Group/GestureTransform * @zparents three/Object3D/Group/** * @zgroup Transforms * @zicon transform */ export declare class GestureTransform extends Group { private _pointers; private _canvas; private _gestureOwned; private _isDragging; private _dragPlaneSet; private _prevPinchDistance; private _prevPinchAngle; private _isTouchTwoFinger; private _prevScreenX; private _activeMouseButton; private _activeDragAction; private _scaleOriginOffsetY; private _scaleOriginComputed; private _gesturePosition; private _gestureRotationY; private _gestureScale; private _rotationVelocity; private _lastRotationDelta; private _lastRotationTime; constructor(contextManager: ContextManager, constructorProps: ConstructorProps); /** * The action performed by a one-finger drag gesture. * @zprop * @zdefault Move * @zgroup Touch * @zgrouppriority 22 */ oneFingerDrag: Observable; /** * The action performed by a two-finger pinch/twist gesture. * @zprop * @zdefault Rotate and Scale * @zgroup Touch * @zgrouppriority 22 */ twoFingerPinch: Observable; /** * The action performed by a left mouse button drag. * @zprop * @zdefault Move * @zgroup Desktop * @zgrouppriority 21 */ leftClickDrag: Observable; /** * The action performed by a right mouse button drag. * @zprop * @zdefault Rotate * @zgroup Desktop * @zgrouppriority 21 */ rightClickDrag: Observable; /** * The action performed by the scroll wheel. * @zprop * @zdefault Scale * @zgroup Desktop * @zgrouppriority 21 */ scrollWheel: Observable; /** * Require the pointer to hit this object's children before starting a gesture. * When false, any pointer on the canvas will start a gesture. * @zprop * @zdefault false * @zgroup Behavior * @zgrouppriority 20 */ requireHitTest: Observable; /** * The plane onto which drag movement is projected. * @zprop * @zdefault Camera * @zgroup Behavior * @zgrouppriority 20 */ dragPlane: Observable; /** * The anchor point from which scale is applied. Bottom keeps the object planted on the ground. * @zprop * @zdefault Center * @zgroup Behavior * @zgrouppriority 20 */ scaleOrigin: Observable; /** * Minimum scale factor. Prevents the object from becoming too small. * @zprop * @zdefault 0.1 * @zgroup Gesture Limits * @zgrouppriority 19 */ minScale: Observable; /** * Maximum scale factor. Prevents the object from becoming too large. * @zprop * @zdefault 10 * @zgroup Gesture Limits * @zgrouppriority 19 */ maxScale: Observable; /** * Sensitivity multiplier for translation. * @zprop * @zdefault 1 * @zgroup Gesture Sensitivity * @zgrouppriority 18 */ translateSensitivity: Observable; /** * Sensitivity multiplier for rotation. * @zprop * @zdefault 1 * @zgroup Gesture Sensitivity * @zgrouppriority 18 */ rotateSensitivity: Observable; /** * Sensitivity multiplier for scale. * @zprop * @zdefault 1 * @zgroup Gesture Sensitivity * @zgrouppriority 18 */ scaleSensitivity: Observable; /** * Whether rotation should have momentum after release. * @zprop * @zdefault true * @zgroup Gesture Feel * @zgrouppriority 17 */ enableMomentum: Observable; /** * Momentum decay time in milliseconds. Lower = stops faster. * @zprop * @zdefault 400 * @zgroup Gesture Feel * @zgrouppriority 17 */ momentumDecay: Observable; /** @zprop */ onTranslateStart: Event<[]>; /** @zprop */ onTranslate: Event<[]>; /** @zprop */ onTranslateEnd: Event<[]>; /** @zprop */ onRotateStart: Event<[]>; /** @zprop */ onRotate: Event<[]>; /** @zprop */ onRotateEnd: Event<[]>; /** @zprop */ onScaleStart: Event<[]>; /** @zprop */ onScale: Event<[]>; /** @zprop */ onScaleEnd: Event<[]>; /** * Observable that is true while a gesture is active. */ readonly isGestureActive: Observable; private _getPointer; private _setPointer; private _removePointer; private _hitTest; private _releaseAllState; private _getScreenCoords; private _onPointerDown; private _resolveOnePointerAction; private _onPointerMove; private _onPointerUp; private _onPointerCancel; private _onTouchStart; private _onTouchMove; private _onTouchEnd; private _onTouchCancel; private _getTouchDistanceAngle; private _onWheel; private _onContextMenu; private _attachListeners; private _detachListeners; private _screenToNDC; private _buildDragPlane; private _raycastPlane; /** * Convert a world space delta into the parent's local space without normalizing, unlike transformDirection. */ private _worldDeltaToLocal; private _handleOneFingerDrag; private _handleOneFingerRotate; private _handleTwoFingerGesture; private _computeScaleOriginOffset; private _expandBoxLocal; private _clampGestureScale; private _endTwoFingerGesture; private _frame; /** * Resets all gesture-applied transforms back to their defaults. */ resetGesture(): void; dispose(): never; }