/** * Copyright (c) 2019-present Houfeng * @author Houfeng */ import { IShapeModel } from "./IShapeModel"; import { ITextStyle } from "./ITextStyle"; import { Rect } from "vector-helper"; import { ShapeStates } from "./ShapeStates"; import { IEditable } from "../Editable"; import { ISceneModel } from "../Scene/ISceneModel"; /** * 图形的模型, * 图形的「位置、大小、如何绘制」都存在于模型中 * 图形组件依据模型中的定义进行最终图形的呈现 */ export declare class ShapeModel extends Rect implements IShapeModel { /** * 对应的 HTML 元素 */ private __element; /** * 对应的 HTML 元素 */ get element(): Element; /** * 设置对应的 HTML 元素 */ setElement: (value: Element) => void; private __region; get region(): Element; setRegionElement: (value: Element) => void; private __scene; get scene(): ISceneModel; get stage(): import("..").IStageModel; /** * 对应的文本编辑实例 */ private __editable; /** * 对应的文本编辑实例 */ get editable(): IEditable; /** * 附加内容 */ attachment: any; /** * 设置对应的文本编辑实例 */ setEditable: (value: IEditable) => void; /** * 图形的唯一 ID */ id: string; /** * 图形的类型 */ type: string; /** * 当前状态 */ state: ShapeStates; /** * 填充颜色 */ fill?: string; /** * 边框颜色 */ stroke?: string; /** * 边框大小 */ strokeWidth: number; /** * 虚线边框设定 */ strokeDasharray?: string; /** * 不透明度 */ opacity: number; /** * 文本 */ text?: any; /** * 文本样式 */ textStyle?: ITextStyle; /** * 水平偏移量 */ translateX: number; /** * 垂直偏移量 */ translateY: number; /** * 编辑占位文本 */ placeholder?: string; /** * 计算相对虚线框 */ get strokeDash(): string; /** * 获取 Regin 的 rect 信息 */ get reginRect(): Rect; /** * 添加文本样式 * @param style 文本样式 */ addTextStyle(style: ITextStyle): void; /** * 获取文本样式 * @param cssProps 样式属性名 */ getTextStyle(cssProps: string[]): any; /** * 移除文本样式 * @param cssProps 样式属性名 */ removeTextStyle(cssProps: string[]): void; /** * 重置文本样式到 initial * @param cssProps 样式属性名 */ resetTextStyle(cssProps: string[]): void; /** * 切换文本样式 * @param style 文本样式 */ toggleTextStyle(style: ITextStyle): void; /** * 旋转后图形所在的距形区域(距形本身是未旋转的坐标) */ get clientRect(): Rect; /** * 获攻取旋转后图形所在的距形区域(距形本身是未旋转的坐标) */ getClientRect(): Rect; /** * 通过选项构建一个图形模型实例 * @param data 图形初始构造数据 */ constructor(scene: ISceneModel, data?: IShapeModel); /** * 获取图形的默认属性或样式 */ static getShapeDefaultProps?: () => any; /** * 序列化 */ toJSON(): { id: string; x: number; y: number; width: number; height: number; angle: number; type: string; fill: string; opacity: number; stroke: string; strokeWidth: number; strokeDasharray: string; text: any; placeholder: string; textStyle: ITextStyle; attachment: any; }; }