[d565449] | 1 | import { Transform } from '../Util.js';
|
---|
| 2 | import { Node } from '../Node.js';
|
---|
| 3 | import { Rect } from './Rect.js';
|
---|
| 4 | import { Group } from '../Group.js';
|
---|
| 5 | import { ContainerConfig } from '../Container.js';
|
---|
| 6 | import { GetSet, IRect, Vector2d } from '../types.js';
|
---|
| 7 | export interface Box extends IRect {
|
---|
| 8 | rotation: number;
|
---|
| 9 | }
|
---|
| 10 | export interface TransformerConfig extends ContainerConfig {
|
---|
| 11 | resizeEnabled?: boolean;
|
---|
| 12 | rotateEnabled?: boolean;
|
---|
| 13 | rotateLineVisible?: boolean;
|
---|
| 14 | rotationSnaps?: Array<number>;
|
---|
| 15 | rotationSnapTolerance?: number;
|
---|
| 16 | rotateAnchorOffset?: number;
|
---|
| 17 | rotateAnchorCursor?: string;
|
---|
| 18 | borderEnabled?: boolean;
|
---|
| 19 | borderStroke?: string;
|
---|
| 20 | borderStrokeWidth?: number;
|
---|
| 21 | borderDash?: Array<number>;
|
---|
| 22 | anchorFill?: string;
|
---|
| 23 | anchorStroke?: string;
|
---|
| 24 | anchorStrokeWidth?: number;
|
---|
| 25 | anchorSize?: number;
|
---|
| 26 | anchorCornerRadius?: number;
|
---|
| 27 | keepRatio?: boolean;
|
---|
| 28 | shiftBehavior?: string;
|
---|
| 29 | centeredScaling?: boolean;
|
---|
| 30 | enabledAnchors?: Array<string>;
|
---|
| 31 | flipEnabled?: boolean;
|
---|
| 32 | node?: Rect;
|
---|
| 33 | ignoreStroke?: boolean;
|
---|
| 34 | boundBoxFunc?: (oldBox: Box, newBox: Box) => Box;
|
---|
| 35 | useSingleNodeRotation?: boolean;
|
---|
| 36 | shouldOverdrawWholeArea?: boolean;
|
---|
| 37 | anchorDragBoundFunc?: (oldPos: Vector2d, newPos: Vector2d, evt: any) => Vector2d;
|
---|
| 38 | anchorStyleFunc?: (anchor: Rect) => void;
|
---|
| 39 | }
|
---|
| 40 | export declare class Transformer extends Group {
|
---|
| 41 | _nodes: Array<Node>;
|
---|
| 42 | _movingAnchorName: string | null;
|
---|
| 43 | _transforming: boolean;
|
---|
| 44 | _anchorDragOffset: Vector2d;
|
---|
| 45 | sin: number;
|
---|
| 46 | cos: number;
|
---|
| 47 | _cursorChange: boolean;
|
---|
| 48 | static isTransforming: () => boolean;
|
---|
| 49 | constructor(config?: TransformerConfig);
|
---|
| 50 | attachTo(node: Node): this;
|
---|
| 51 | setNode(node: Node): this;
|
---|
| 52 | getNode(): Node<import("../Node.js").NodeConfig>;
|
---|
| 53 | _getEventNamespace(): string;
|
---|
| 54 | setNodes(nodes?: Array<Node>): this;
|
---|
| 55 | _proxyDrag(node: Node): void;
|
---|
| 56 | getNodes(): Node<import("../Node.js").NodeConfig>[];
|
---|
| 57 | getActiveAnchor(): string | null;
|
---|
| 58 | detach(): void;
|
---|
| 59 | _resetTransformCache(): void;
|
---|
| 60 | _getNodeRect(): any;
|
---|
| 61 | __getNodeShape(node: Node, rot?: number, relative?: Node): {
|
---|
| 62 | rotation: number;
|
---|
| 63 | x: number;
|
---|
| 64 | y: number;
|
---|
| 65 | width: number;
|
---|
| 66 | height: number;
|
---|
| 67 | };
|
---|
| 68 | __getNodeRect(): {
|
---|
| 69 | x: number;
|
---|
| 70 | y: number;
|
---|
| 71 | width: number;
|
---|
| 72 | height: number;
|
---|
| 73 | rotation: number;
|
---|
| 74 | };
|
---|
| 75 | getX(): any;
|
---|
| 76 | getY(): any;
|
---|
| 77 | getWidth(): any;
|
---|
| 78 | getHeight(): any;
|
---|
| 79 | _createElements(): void;
|
---|
| 80 | _createAnchor(name: any): void;
|
---|
| 81 | _createBack(): void;
|
---|
| 82 | _handleMouseDown(e: any): void;
|
---|
| 83 | _handleMouseMove(e: any): void;
|
---|
| 84 | _handleMouseUp(e: any): void;
|
---|
| 85 | getAbsoluteTransform(): Transform;
|
---|
| 86 | _removeEvents(e?: any): void;
|
---|
| 87 | _fitNodesInto(newAttrs: any, evt?: any): void;
|
---|
| 88 | forceUpdate(): void;
|
---|
| 89 | _batchChangeChild(selector: string, attrs: any): void;
|
---|
| 90 | update(): void;
|
---|
| 91 | isTransforming(): boolean;
|
---|
| 92 | stopTransform(): void;
|
---|
| 93 | destroy(): this;
|
---|
| 94 | toObject(): {
|
---|
| 95 | attrs: any;
|
---|
| 96 | className: string;
|
---|
[0c6b92a] | 97 | children?: Array<any>;
|
---|
[d565449] | 98 | };
|
---|
| 99 | clone(obj?: any): this;
|
---|
| 100 | getClientRect(): IRect;
|
---|
| 101 | nodes: GetSet<Node[], this>;
|
---|
| 102 | enabledAnchors: GetSet<string[], this>;
|
---|
| 103 | rotationSnaps: GetSet<number[], this>;
|
---|
| 104 | anchorSize: GetSet<number, this>;
|
---|
| 105 | resizeEnabled: GetSet<boolean, this>;
|
---|
| 106 | rotateEnabled: GetSet<boolean, this>;
|
---|
| 107 | rotateLineVisible: GetSet<boolean, this>;
|
---|
| 108 | rotateAnchorOffset: GetSet<number, this>;
|
---|
| 109 | rotationSnapTolerance: GetSet<number, this>;
|
---|
| 110 | rotateAnchorCursor: GetSet<string, this>;
|
---|
| 111 | padding: GetSet<number, this>;
|
---|
| 112 | borderEnabled: GetSet<boolean, this>;
|
---|
| 113 | borderStroke: GetSet<string, this>;
|
---|
| 114 | borderStrokeWidth: GetSet<number, this>;
|
---|
| 115 | borderDash: GetSet<number[], this>;
|
---|
| 116 | anchorFill: GetSet<string, this>;
|
---|
| 117 | anchorStroke: GetSet<string, this>;
|
---|
| 118 | anchorCornerRadius: GetSet<number, this>;
|
---|
| 119 | anchorStrokeWidth: GetSet<number, this>;
|
---|
| 120 | keepRatio: GetSet<boolean, this>;
|
---|
| 121 | shiftBehavior: GetSet<string, this>;
|
---|
| 122 | centeredScaling: GetSet<boolean, this>;
|
---|
| 123 | flipEnabled: GetSet<boolean, this>;
|
---|
| 124 | ignoreStroke: GetSet<boolean, this>;
|
---|
| 125 | boundBoxFunc: GetSet<(oldBox: Box, newBox: Box) => Box, this>;
|
---|
| 126 | anchorDragBoundFunc: GetSet<(oldPos: Vector2d, newPos: Vector2d, e: MouseEvent) => Vector2d, this>;
|
---|
| 127 | anchorStyleFunc: GetSet<null | ((Node: Rect) => void), this>;
|
---|
| 128 | shouldOverdrawWholeArea: GetSet<boolean, this>;
|
---|
| 129 | useSingleNodeRotation: GetSet<boolean, this>;
|
---|
| 130 | }
|
---|