import { Box2 } from '../math/box2'; import { Line2, Vector2 } from '../math'; import type { LayoutInfo } from './types'; /** * 自动布局的纯计算函数与相关类型,只依赖 gizmo/math 与 LayoutInfo。 */ export type SiblingInfo = { /** 元素 id */ id: string; /** 视图包围盒 */ box: Box2; /** 包围盒中心点 */ center: Vector2; /** 自动布局位置信息(可选) */ layoutInfo?: LayoutInfo; }; /** * 自动布局指示器数据。 */ export type AutoLayoutIndicator = { frameId: string; insertIndex: number; insertDirection: 'before' | 'after'; targetSiblingId?: string; line: Line2; targetRow?: number; targetColumn?: number; } | null; /** * 布局位置信息。 */ export type LayoutPosition = { row: number; column: number; }; /** * 插入位置信息。 */ export type InsertInfo = { index: number; direction: 'before' | 'after'; siblingId?: string; row: number; column: number; rowChange?: { fromRow: number; toRow: number; rowBounds?: { minY: number; maxY: number; minX: number; maxX: number; }; isRowChange: boolean; }; box?: Box2; }; /** * 兄弟元素布局信息。 */ export type SiblingWithInfo = { id: string; box: Box2; row: number; column: number; centerX: number; }; /** * 计算自动布局插入指示线。 * @param insertInfo 插入位置信息 * @returns 主指示线 */ export declare function calculateAutoLayoutIndicatorLine(insertInfo: InsertInfo): Line2; /** * 基于鼠标位置计算布局位置(row 和 column)。 * @param mousePoint 鼠标位置 * @param siblingInfos 所有兄弟元素的信息 * @returns 布局位置信息 { row: number, column: number } */ export declare function calculateAutoLayoutPositionByMouse(mousePoint: Vector2, siblingInfos: SiblingInfo[]): LayoutPosition | null; /** * 基于鼠标位置计算插入位置(用于显示指示器)。 * @param mousePoint 鼠标位置 * @param siblingsWithInfos 所有兄弟元素信息 * @param allChildren 所有兄弟元素ID数组 * @param originalRow 原始行号 * @returns 插入位置信息和计算出的行列位置 */ export declare function calculateInsertPositionFromLayout(mousePoint: Vector2, siblingsWithInfos: SiblingWithInfo[], allChildren: string[], originalRow: number): InsertInfo;