import { PositionSchema } from './position-schema'; import { SizeSchema } from './size-schema'; import { OriginSchema } from './origin-schema'; import { ScaleSchema } from './scale-schema'; import { SkewSchema } from './skew-schema'; import { EntityData } from '../entity-data'; import type { Entity } from '../entity'; import { Matrix, Rectangle } from '@gedit/math'; import { TransformSchema, TransformSchemaDecoration } from '@gedit/utils'; interface Point { x: number; y: number; } interface VData { x: number; y: number; nx: number; ny: number; len: number; ang: number; } declare const asVec: (p: Point, pp: Point) => VData; export { TransformSchemaDecoration, TransformSchema, asVec }; interface Rect { x: number; y: number; width: number; height: number; } export declare class TransformData extends EntityData implements TransformSchema { protected entity: Entity; static type: string; protected _worldTransform: Matrix; protected _localTransform: Matrix; protected _children: TransformData[] | undefined; protected worldCache: Map; sizeToScale: boolean; componentSceneSize?: { width: number; height: number; }; isMask?: boolean; maskTransform?: TransformData; visible?: boolean; get children(): TransformData[]; /** * 标记为容器,则选择框会动态计算子节点大小 */ isContainer: boolean; /** * 标记为路径, path 路径移动中心点时不更新 position,, resizable 里使用; */ isPath: boolean; /** * The X-coordinate value of the normalized local X axis, * the first column of the local transformation matrix without a scale. */ protected _cx: number; /** * The Y-coordinate value of the normalized local X axis, * the first column of the local transformation matrix without a scale. */ protected _sx: number; /** * The X-coordinate value of the normalized local Y axis, * the second column of the local transformation matrix without a scale. */ protected _cy: number; /** * The Y-coordinate value of the normalized local Y axis, * the second column of the local transformation matrix without a scale. */ protected _sy: number; /** * The locally unique ID of the local transform. */ protected _localID: number; /** * The locally unique ID of the local transform * used to calculate the current local transformation matrix. */ protected _currentLocalID: number; /** * The locally unique ID of the world transform. */ protected _worldID: number; /** * The locally unique ID of the parent's world transform * used to calculate the current world transformation matrix. */ protected _parentID: number; /** * The parent transform */ protected _parent?: TransformData; constructor(entity: Entity); private bindChanged; fireChanged(): void; get localTransform(): Matrix; get worldTransform(): Matrix; getDefaultData(): TransformSchema; update(data: Partial): void; get position(): PositionSchema; set position(position: PositionSchema); get size(): SizeSchema; set size(size: SizeSchema); get origin(): OriginSchema; set origin(origin: OriginSchema); get scale(): ScaleSchema; set scale(scale: ScaleSchema); get skew(): SkewSchema; set skew(skew: SkewSchema); get rotation(): number; set rotation(rotation: number); get data(): TransformSchema; /** * Called when the skew or the rotation changes. * * @protected */ protected updateSkew(): void; /** * Updates the local transformation matrix. */ protected updateLocalTransformMatrix(): void; /** * Updates the local and the world transformation matrices. * */ protected updateTransformMatrix(): void; /** * Decomposes a matrix and sets the transforms properties based on it. * * matrix - The matrix to decompose */ setFromMatrix(matrix: Matrix): void; protected getFromWorldCache(key: string, fn: () => T): T; protected setPIXIOriginToRect(rect: Rect): void; /** * bounds; * container 使用带中心点旋转后重新计算的 bounds * * 带父级中心点旋转后重新计算的 bounds; */ get bounds(): Rectangle; protected boundsMask(bounds: Rectangle, maskBounds?: Rectangle): Rectangle; /** * 不旋转的bounds */ get boundsWithoutRotation(): Rectangle; /** * 本身的大小 */ get localSize(): SizeSchema; get worldSize(): SizeSchema; /** * 本地bounds */ get localBounds(): Rectangle; /** * 判断是否包含点 * @param x * @param y * @param asCircle - 以圆形来算,TODO 目前不支持椭圆形 */ contains(x: number, y: number, asCircle?: boolean): boolean; get parent(): TransformData | undefined; isParent(parent: TransformData): boolean; private _parentChangedDispose?; setParent(parent: TransformData | undefined, listenParentData?: boolean): void; /** * 判断矩形碰撞 */ intersects(rect: Rectangle): boolean; /** * 全局的scale */ get worldScale(): ScaleSchema; /** * 全局的rotation */ get worldRotation(): number; /** * 全局的角度 */ get worldDegree(): number; /** * 全局的原点位置 */ get worldOrigin(): PositionSchema; isParentTransform(parent?: TransformData): boolean; /** * 宽转换成scale,用于图片等无法修改大小的场景 * @param width * @param isWorldSize 是否为绝对大小 */ widthToScaleX(width: number, isWorldSize?: boolean): number; /** * 绝对高转换成scale,用于图片等无法修改大小的场景 * @param worldHeight * @param isWorldSize 是否为绝对大小 */ heightToScaleY(height: number, isWorldSize?: boolean): number; sizeToScaleValue(size: { width: number; height: number; }, isWorldSize?: boolean): { x: number; y: number; }; } export declare namespace TransformData { /** * @param dragableEntities * @param target */ function isParentOrChildrenTransform(dragableEntities: Entity[], target: Entity): boolean; } //# sourceMappingURL=transform-schema.d.ts.map