import Controller from "../Controller"; import EventTrigger from "../EventTrigger"; export declare type pathComments = { /** 当前批注ID */ commentsId: string; /** 当前批注类型 */ type: "path"; /** 画笔路径 */ d_path: string; /** 颜色 */ stroke: string; /** 画笔粗细 */ stroke_width: string; }; export declare type circleComments = { /** 当前批注ID */ commentsId: string; /** 当前批注类型 */ type: "ellipse"; /** x轴位置 */ cx: string; /** y轴位置 */ cy: string; /** 半径x */ rx: string; /** 半径y */ ry: string; /** 颜色 */ stroke: string; /** 画笔粗细 */ stroke_width: string; }; export declare type rectangleComments = { /** 当前批注ID */ commentsId: string; /** 当前批注类型 */ type: "rect"; /** 宽 */ x: string; /** 高 */ y: string; /** 颜色 */ stroke: string; /** 画笔粗细 */ stroke_width: string; }; export declare type arrowComments = { /** 当前批注ID */ commentsId: string; /** 当前批注类型 */ type: "arrow"; /** 箭头起点 */ start: string; /** 箭头终点 */ end: string; /** 颜色 */ stroke: string; /** 画笔粗细 */ stroke_width: string; }; export declare type textComments = { /** 当前批注ID */ commentsId: string; /** 当前批注类型 */ type: "text"; /** 文字内容 */ content: string; /** 颜色 */ stroke: string; /** 画笔粗细 */ stroke_width: string; }; /** * 表示截图工具类 * @class */ export default class CommentsTool extends Controller { protected eventTrigger: EventTrigger; protected _commentsList: any; protected _currentsComments: any; protected _currentMode: string; protected _Pathcolor: string; protected _Ellipsecolor: string; protected _Rectcolor: string; protected _Arrowcolor: string; protected _Textcolor: string; protected _PathstrokeWidth: string; protected _EllipsestrokeWidth: string; protected _RectstrokeWidth: string; protected _ArrowstrokeWidth: string; protected _TextstrokeWidth: string; protected _FontSize: string; protected _stratchPos: string; protected isCreating: boolean; protected isDrawing: boolean; protected isChosed: boolean; protected isHolding: boolean; protected isStretch: boolean; protected isMoving: boolean; protected isHovering: boolean; protected isDuplicate: boolean; protected isTyping: boolean; protected chosedTarget: any; protected selectionBox: any; protected handles: any; protected _revocationMechanism: RevocationMechanism | null; protected _offsetX: number; protected _offsetY: number; protected _isTouch: boolean; /** * 创建一个截图工具对象 * @param {*} parent * @param {*} cfg */ constructor(parent: any, cfg: any); saveSVG(): void; protected initEventListeners(): void; clickCreateText(touchevent: any, textContent: string): void; protected getInitVector(vectorNum1: number, vectorNum2: number): number[]; protected getVerticalUnitVector(vectorNum1: number, vectorNum2: number): number[]; protected getTwoPointLength(Num1: number, Num2: number): number; protected hiddenAllInput(): void; protected showHiddenSelectedBox(show: boolean): void; protected updateSelectionBox(): void; protected publishComments(): void; protected updateCommentsColor(): void; protected deleteSvgCommentsListeners(): void; protected deleteCurrentComments(): void; protected getTime(): any; protected duplicateComment(): void; protected AddNewState(done: Function): void; protected saveCurrentState(done: Function): void; protected displayState(stateContent: gType[]): void; autoSaveInput(callback?: Function): void; /** * 设置当前批注类型 * @param type */ setCurrentMode(type: string): void; /** * 重做 */ ReDo(done?: Function): void; /** * 撤销 */ UnDo(done?: Function): void; checkSelectionBox(): void; /** * 结束批注功能 */ endCommentsTool(): void; /** * 保存批注并发布 */ saveComments(callback?: Function): void; /** * 修改选中对象颜色 * @param color 颜色名称或者代码 */ setTargetColor(color: string): void; /** * 修改选中对象尺寸 * @param size 默认是5 */ setTargetWidth(size: number): void; /** * 设置是否为触屏模式 * @param {boolean} value */ set isTouch(value: boolean); set offsetX(x: number); set offsetY(y: number); /** * 设置path批注颜色 * @param color 颜色名称或者代码 */ set pathColor(color: string); /** * 设置Ellipse批注颜色 * @param color 颜色名称或者代码 */ set ellipseColor(color: string); /** * 设置Rect批注颜色 * @param color 颜色名称或者代码 */ set rectColor(color: string); /** * 设置Arrow批注颜色 * @param color 颜色名称或者代码 */ set arrowColor(color: string); /** * 设置Text批注颜色 * @param color 颜色名称或者代码 */ set textColor(color: string); /** * 设置Path批注粗细 * @param width 默认是3 */ set pathStrokeWidth(width: string); /** * 设置Ellipse批注粗细 * @param width 默认是3 */ set ellipseStrokeWidth(width: string); /** * 设置Rect批注粗细 * @param width 默认是3 */ set rectStrokeWidth(width: string); /** * 设置Arrow箭头大小 * @param size 默认是3 */ set arrowSize(size: string); /** * 设置Text字体大小 * @param size 默认是14,建议区间12-16 */ set textFontSize(size: string); destroy(): void; } /** * 撤销机制 */ declare class RevocationMechanism { stateMap: Map; stateIndex: number; protected eventTrigger: EventTrigger; constructor(eventTrigger: EventTrigger); AddNewState(content: gType[], done: Function): void; ReDo(returnContent: Function): void; UnDo(returnContent: Function): void; destroy(): void; } /** * 表示批注的内容的g标签类,用于保存g标签内容及其子级内容 */ declare class gType { attributes: NamedNodeMap; childrenContents: Map; textContent: string | null; constructor(attributes: NamedNodeMap, childrenContents: Map, textContent: string | null); } export {};