diff --git a/types/two.js/index.d.ts b/types/two.js/index.d.ts index 08eba80123..39e18d0b71 100644 --- a/types/two.js/index.d.ts +++ b/types/two.js/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for js 0.7 // Project: https://two.js.org // Definitions by: Carlos Precioso +// Konstantin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -273,7 +274,7 @@ declare namespace Two { number > {} - type Object = Path | Group; + type Object = Path | Group | Text; class Vector { constructor(x: number, y: number); @@ -298,7 +299,7 @@ declare namespace Two { length(): number; normalize(): this; distanceTo(v: Vector): number; - distanceSquared(v: Vector): number; + distanceToSquared(v: Vector): number; setLength(length: number): this; equals(v: Vector): boolean; lerp(v: Vector, t: number): this; diff --git a/types/two.js/two.js-tests.ts b/types/two.js/two.js-tests.ts index d94a082867..01a89c9069 100644 --- a/types/two.js/two.js-tests.ts +++ b/types/two.js/two.js-tests.ts @@ -75,3 +75,15 @@ import Two = require("two.js"); group.rotation += t * 4 * Math.PI; }).play(); // Finally, start the animation loop } + +{ + const two = new Two({ width: 300, height: 500 }); + const text = new Two.Text('text test', 10, 10); + two.add(text); +} + +{ + const v = new Two.Vector(0, 0); + const dist = v.distanceToSquared(new Two.Vector(100, 200)); + v.x = dist; +}