import type { Engine } from '@galacean/effects'; import type { Vector2 } from '../math/vector2'; import { FrameLayoutMode, type AutoLayoutConfig, type FrameInfo, type LayoutInfo } from './types'; import { type FrameAutoLayoutOptions, type FrameAutoLayoutResult, type FrameLayoutItem } from './frame-auto-layout'; /** * Frame runtime data. Every ID in this record is a VFXItem.instanceId. * Hosts that need stable IDs must translate at their serialization boundary. */ export type FrameRecord = { id: string; layoutMode: FrameLayoutMode; children: string[]; autoLayoutConfig?: AutoLayoutConfig; layoutInfos: Record; }; export type FrameRecordInput = { id: string; layoutMode?: FrameLayoutMode; children?: readonly string[]; autoLayoutConfig?: AutoLayoutConfig; layoutInfos?: Readonly>; }; /** * Runtime Frame model owned by a GestureHandler. * It is intentionally unaware of host persistence IDs. */ export declare class FrameManager { private readonly _records; private readonly _boxes; private readonly _engine; /** * @param engine 关联的 effects Engine,供 `updateViewBoxes()` 更新投影几何(记录 / 布局 / 自动布局计算不依赖它)。 * 构造期一次性注入,不再走 bind/unbind 生命周期——生产唯一构造点 GestureHandler 恒以 player.engine 注入。 */ constructor(engine: Engine); upsertFrame(input: FrameRecordInput): FrameRecord; ensureFrame(input: FrameRecordInput): FrameRecord; deleteFrame(id: string): boolean; clear(): void; hydrate(records: readonly FrameRecordInput[]): void; snapshot(): FrameRecord[]; getFrame(id: string): Readonly | undefined; getFrames(): readonly Readonly[]; setLayoutMode(id: string, layoutMode: FrameLayoutMode): void; setChildren(id: string, children: readonly string[]): void; addChild(id: string, childId: string): boolean; removeChild(id: string, childId: string): boolean; setLayoutInfos(id: string, layoutInfos: Readonly> | undefined): void; setChildLayoutInfo(id: string, childId: string, layoutInfo: LayoutInfo): void; setAutoLayoutConfig(id: string, config: AutoLayoutConfig | undefined): void; computeAutoLayout(frameId: string, items: readonly Pick[], options?: Omit): FrameAutoLayoutResult | undefined; computeLayoutInfosAfterReorder(frameId: string, draggedItemId: string, fromRow: number, fromColumn: number, toRow: number, toColumn: number): Record | undefined; /** Frame 生命周期入口;实际投影更新统一委托给 updateViewBoxes。 */ onPreRender(): void; /** 同步更新动态 Engine 几何;metadata 始终直接读取 records。 */ updateViewBoxes(): void; getViewInfos(): FrameInfo[]; getViewInfo(id: string): FrameInfo | undefined; getParentFrame(itemId: string): Readonly | undefined; findFrameAt(point: Vector2): FrameInfo | undefined; private _toViewInfo; }