|
| 1 | +declare module 'two.js/src/anchor' { |
| 2 | + /** |
| 3 | + * @class |
| 4 | + * @name Two.Anchor |
| 5 | + * @param {Number} [x=0] - The x position of the root anchor point. |
| 6 | + * @param {Number} [y=0] - The y position of the root anchor point. |
| 7 | + * @param {Number} [ax=0] - The x position of the left handle point. |
| 8 | + * @param {Number} [ay=0] - The y position of the left handle point. |
| 9 | + * @param {Number} [bx=0] - The x position of the right handle point. |
| 10 | + * @param {Number} [by=0] - The y position of the right handle point. |
| 11 | + * @param {String} [command=Two.Commands.move] - The command to describe how to render. Applicable commands are {@link Two.Commands} |
| 12 | +
|
| 13 | + * @description An object that holds 3 {@link Two.Vector}s, the anchor point and its corresponding handles: `left` and `right`. In order to properly describe the bezier curve about the point there is also a command property to describe what type of drawing should occur when Two.js renders the anchors. |
| 14 | + */ |
| 15 | + export class Anchor extends Vector { |
| 16 | + static makeBroadcast(scope: Anchor): () => void; |
| 17 | + /** |
| 18 | + * @name Two.Anchor.fromObject |
| 19 | + * @function |
| 20 | + * @param {Object} obj - Object notation of a {@link Two.Anchor} to create a new instance |
| 21 | + * @returns {Two.Anchor} |
| 22 | + * @description Create a new {@link Two.Anchor} from an object notation of a {@link Two.Anchor}. |
| 23 | + * @nota-bene Works in conjunction with {@link Two.Anchor#toObject} |
| 24 | + */ |
| 25 | + static fromObject( |
| 26 | + obj: |
| 27 | + | object |
| 28 | + | { |
| 29 | + x?: number; |
| 30 | + y?: number; |
| 31 | + command?: Commands[keyof Commands]; |
| 32 | + relative?: boolean; |
| 33 | + controls?: { |
| 34 | + left: { x: number; y: number } | Vector; |
| 35 | + right: { x: number; y: number } | Vector; |
| 36 | + }; |
| 37 | + rx?: number; |
| 38 | + ry?: number; |
| 39 | + xAxisRotation?: number; |
| 40 | + largeArcFlag?: number; |
| 41 | + } |
| 42 | + ): Anchor; |
| 43 | + constructor( |
| 44 | + x?: number, |
| 45 | + y?: number, |
| 46 | + ax?: number, |
| 47 | + ay?: number, |
| 48 | + bx?: number, |
| 49 | + by?: number, |
| 50 | + command?: Commands[keyof Commands] |
| 51 | + ); |
| 52 | + controls: { |
| 53 | + left: Vector; |
| 54 | + right: Vector; |
| 55 | + }; |
| 56 | + command: Commands[keyof Commands]; |
| 57 | + relative: boolean; |
| 58 | + rx?: number; |
| 59 | + ry?: number; |
| 60 | + xAxisRotation?: number; |
| 61 | + largeArcFlag?: number; |
| 62 | + sweepFlag?: number; |
| 63 | + /** |
| 64 | + * @name Two.Anchor#copy |
| 65 | + * @function |
| 66 | + * @param {Two.Anchor} v - The anchor to apply values to. |
| 67 | + * @description Copy the properties of one {@link Two.Anchor} onto another. |
| 68 | + */ |
| 69 | + copy(anchor: Anchor): Anchor; |
| 70 | + /** |
| 71 | + * @name Two.Anchor#clone |
| 72 | + * @function |
| 73 | + * @returns {Two.Anchor} |
| 74 | + * @description Create a new {@link Two.Anchor}, set all its values to the current instance and return it for use. |
| 75 | + */ |
| 76 | + clone(): Anchor; |
| 77 | + /** |
| 78 | + * @name Two.Anchor#toObject |
| 79 | + * @function |
| 80 | + * @returns {Object} - An object with properties filled out to mirror {@link Two.Anchor}. |
| 81 | + * @description Create a JSON compatible plain object of the current instance. Intended for use with storing values in a database. |
| 82 | + * @nota-bene Works in conjunction with {@link Two.Anchor.fromObject} |
| 83 | + */ |
| 84 | + toObject(): object; |
| 85 | + /** |
| 86 | + * @name Two.Anchor#toString |
| 87 | + * @function |
| 88 | + * @returns {String} - A String with comma-separated values reflecting the various values on the current instance. |
| 89 | + * @description Create a string form of the current instance. Intended for use with storing values in a database. This is lighter to store than the JSON compatible {@link Two.Anchor#toObject}. |
| 90 | + */ |
| 91 | + toString(): string; |
| 92 | + } |
| 93 | + import { Vector } from 'two.js/src/vector'; |
| 94 | + import { Commands } from 'two.js/src/utils/path-commands'; |
| 95 | +} |
0 commit comments