import { type InputEventMouseButton, type InputEventMouseMotion, type VFXItem } from '@galacean/effects'; import { type GestureCursorResult } from '../cursor'; import { Gizmo } from '../gizmo'; import type { GizmoOwner } from '../gizmo-owner'; import { GizmoType } from '../gizmo-type'; import { Vector2 } from '../math'; import { ResizeSelectionGizmo } from './resize-selection-gizmo'; /** * 选框角旋转行为。 * * 本行为独立负责角旋转的命中、光标、pointer capture 与旋转拖拽; * {@link ResizeSelectionGizmo} 只维护选框几何、绘制和缩放。两者通过构造函数共享同一份 * wireframe,避免旋转与缩放分别投影选框后产生命中偏差。 */ export declare class CornerRotationGizmo extends Gizmo { private readonly _resizeSelection; readonly type: GizmoType; cursorResult: GestureCursorResult; /** 当前指针的视图坐标;拖拽期间按 Control 本地坐标增量推进。 */ cursorPoint: Vector2; /** 上一帧指针的 Control 本地坐标。 */ lastPoint: Vector2; /** 单次旋转会话累计的 z 轴角度,用于保持旋转光标朝向连续。 */ rotationAngle: number; private _rotationActive; private _anchor; private _interactiveDirection; /** 未吸附的累计拖拽角,独立于已应用角度,避免逐帧取整丢失小幅移动。 */ private _rawRotationAngle; /** pointer down 时选框局部 x 轴的绝对角度,用于吸附最终朝向而非单次拖拽增量。 */ private _initialSelectionAngle; constructor(owner: GizmoOwner, _resizeSelection: ResizeSelectionGizmo); get selectedItems(): VFXItem[]; private _isApplicableSelection; /** 无按键 hover 命中旋转区时先于 ResizeSelection 接管,阻止下游元素预选。 */ onMouseMove(event: InputEventMouseMotion): void; /** captured 后的 Drag 相位继续旋转。 */ onMouseDrag(event: InputEventMouseMotion): void; /** pointer down 时现刷共享选框并只在角旋转区建立会话。 */ onMouseDown(event: InputEventMouseButton): void; onMouseUp(event: InputEventMouseButton): void; onMouseLeave(): void; private _updateRotationDrag; /** * 对累计角度应用当前约束。先把“选框初始角 + 拖拽总角” * 量化到 15°,再减回初始角,从而让最终朝向对齐到 15° 的整数倍。 */ private _applyRotation; private _resetOperation; /** * 旋转命中区从角点沿两个外侧局部轴展开。与缩放角点重叠的内侧 14×14px 方形明确让出, * 因而即使 CornerRotationGizmo 在派发序中位于 ResizeSelection 前面,缩放角点仍能获胜。 */ private _findRotationHit; private _boxLocalAxes; private _refreshHover; private _setRotationCursor; private _clearHover; }