[two.js] Update 'Object' type and 'distanceToSquared' method typo (#35914)

* Update index.d.ts

* Update index.d.ts

* Update two.js-tests.ts

* Update two.js-tests.ts

* Update two.js-tests.ts

* Update two.js-tests.ts
This commit is contained in:
Konstantin 2019-06-04 21:18:40 +03:00 committed by Andrew Casey
parent fb623cb9bb
commit bf0310e305
2 changed files with 15 additions and 2 deletions

View File

@ -1,6 +1,7 @@
// Type definitions for js 0.7
// Project: https://two.js.org
// Definitions by: Carlos Precioso <https://github.com/cprecioso>
// Konstantin <https://github.com/demkonst>
// 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;

View File

@ -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;
}