mirror of
https://github.com/photonstorm/phaser
synced 2024-11-21 20:23:19 +00:00
Merge pull request #6746 from lukas-dachtler/fix/matterJSTypes
fixed MatterJS type definitions
This commit is contained in:
commit
b8839e4e70
2 changed files with 28 additions and 27 deletions
|
@ -542,7 +542,7 @@ var Axes = require('../geometry/Axes');
|
||||||
* @method setPosition
|
* @method setPosition
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {vector} position
|
* @param {vector} position
|
||||||
* @param {boolean} updateVelocity
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
Body.setPosition = function(body, position, updateVelocity) {
|
Body.setPosition = function(body, position, updateVelocity) {
|
||||||
var delta = Vector.sub(position, body.position);
|
var delta = Vector.sub(position, body.position);
|
||||||
|
@ -571,7 +571,7 @@ var Axes = require('../geometry/Axes');
|
||||||
* @method setAngle
|
* @method setAngle
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {number} angle
|
* @param {number} angle
|
||||||
* @param {boolean} updateVelocity
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
Body.setAngle = function(body, angle, updateVelocity) {
|
Body.setAngle = function(body, angle, updateVelocity) {
|
||||||
var delta = angle - body.angle;
|
var delta = angle - body.angle;
|
||||||
|
@ -697,7 +697,7 @@ var Axes = require('../geometry/Axes');
|
||||||
* @method translate
|
* @method translate
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {vector} translation
|
* @param {vector} translation
|
||||||
* @param {boolean} [updateVelocity]
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
Body.translate = function(body, translation, updateVelocity) {
|
Body.translate = function(body, translation, updateVelocity) {
|
||||||
Body.setPosition(body, Vector.add(body.position, translation), updateVelocity);
|
Body.setPosition(body, Vector.add(body.position, translation), updateVelocity);
|
||||||
|
@ -709,7 +709,7 @@ var Axes = require('../geometry/Axes');
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {number} rotation
|
* @param {number} rotation
|
||||||
* @param {vector} [point]
|
* @param {vector} [point]
|
||||||
* @param {boolean} [updateVelocity]
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
Body.rotate = function(body, rotation, point, updateVelocity) {
|
Body.rotate = function(body, rotation, point, updateVelocity) {
|
||||||
if (!point) {
|
if (!point) {
|
||||||
|
|
47
types/matter.d.ts
vendored
47
types/matter.d.ts
vendored
|
@ -5,6 +5,7 @@
|
||||||
// Piotr Pietrzak <https://github.com/hasparus>,
|
// Piotr Pietrzak <https://github.com/hasparus>,
|
||||||
// Richard Davey <rich@photonstorm.com>
|
// Richard Davey <rich@photonstorm.com>
|
||||||
|
|
||||||
|
/// <reference types="./phaser" />
|
||||||
declare namespace MatterJS {
|
declare namespace MatterJS {
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
|
@ -405,7 +406,7 @@ declare namespace MatterJS {
|
||||||
* @property gameObject
|
* @property gameObject
|
||||||
* @type Phaser.GameObjects.GameObject
|
* @type Phaser.GameObjects.GameObject
|
||||||
*/
|
*/
|
||||||
gameObject?: any;
|
gameObject?: Phaser.GameObjects.GameObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scale the influence of World gravity when applied to this body.
|
* Scale the influence of World gravity when applied to this body.
|
||||||
|
@ -468,13 +469,13 @@ declare namespace MatterJS {
|
||||||
onCollideActiveCallback?: Function;
|
onCollideActiveCallback?: Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collision callback dictionary used by the `Body.setOnCollideWith` function.
|
* A collision callback dictionary _(body id -> function)_ used by the `Body.setOnCollideWith` function.
|
||||||
*
|
*
|
||||||
* @property onCollideWith
|
* @property onCollideWith
|
||||||
* @type object
|
* @type {Object.<number, Function>}
|
||||||
* @default null
|
* @default {}
|
||||||
*/
|
*/
|
||||||
onCollideWith?: any;
|
onCollideWith?: Record<number, Function>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1434,7 +1435,7 @@ declare namespace MatterJS {
|
||||||
* A `Number` specifying the delta time, in ms, since the last game step
|
* A `Number` specifying the delta time, in ms, since the last game step
|
||||||
*/
|
*/
|
||||||
deltaTime: number;
|
deltaTime: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of `Vector` objects that specify the convex hull of the rigid body.
|
* An array of `Vector` objects that specify the convex hull of the rigid body.
|
||||||
* These should be provided about the origin `(0, 0)`. E.g.
|
* These should be provided about the origin `(0, 0)`. E.g.
|
||||||
|
@ -1860,7 +1861,7 @@ declare namespace MatterJS {
|
||||||
* @property gameObject
|
* @property gameObject
|
||||||
* @type Phaser.GameObjects.GameObject
|
* @type Phaser.GameObjects.GameObject
|
||||||
*/
|
*/
|
||||||
gameObject?: any;
|
gameObject?: Phaser.GameObjects.GameObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The scale of the Body.
|
* The scale of the Body.
|
||||||
|
@ -1952,13 +1953,13 @@ declare namespace MatterJS {
|
||||||
onCollideActiveCallback?: Function;
|
onCollideActiveCallback?: Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collision callback dictionary used by the `Body.setOnCollideWith` function.
|
* A collision callback dictionary _(body id -> function)_ used by the `Body.setOnCollideWith` function.
|
||||||
*
|
*
|
||||||
* @property onCollideWith
|
* @property onCollideWith
|
||||||
* @type object
|
* @type {Object.<number, Function>}
|
||||||
* @default null
|
* @default {}
|
||||||
*/
|
*/
|
||||||
onCollideWith?: any;
|
onCollideWith?: Record<number, Function>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the onCollideWith callback.
|
* Sets the onCollideWith callback.
|
||||||
|
@ -2266,7 +2267,7 @@ declare namespace MatterJS {
|
||||||
* @method rotate
|
* @method rotate
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {number} rotation
|
* @param {number} rotation
|
||||||
* @param {boolean} [updateVelocity]
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
static rotate (body: BodyType, rotation: number, updateVelocity?: boolean): void;
|
static rotate (body: BodyType, rotation: number, updateVelocity?: boolean): void;
|
||||||
|
|
||||||
|
@ -2367,18 +2368,18 @@ declare namespace MatterJS {
|
||||||
* @method setPosition
|
* @method setPosition
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {vector} position
|
* @param {vector} position
|
||||||
* @param {boolean} updateVelocity
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
static setPosition (body: BodyType, position: Vector, updateVelocity: boolean): void;
|
static setPosition (body: BodyType, position: Vector, updateVelocity?: boolean): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged.
|
* Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged.
|
||||||
* @method setAngle
|
* @method setAngle
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {number} angle
|
* @param {number} angle
|
||||||
* @param {boolean} updateVelocity
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
static setAngle (body: BodyType, angle: number, updateVelocity: boolean): void;
|
static setAngle (body: BodyType, angle: number, updateVelocity?: boolean): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`.
|
* Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`.
|
||||||
|
@ -2419,7 +2420,7 @@ declare namespace MatterJS {
|
||||||
* @method translate
|
* @method translate
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {vector} translation
|
* @param {vector} translation
|
||||||
* @param {boolean} [updateVelocity]
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
static translate (body: BodyType, translation: Vector, updateVelocity?: boolean): void;
|
static translate (body: BodyType, translation: Vector, updateVelocity?: boolean): void;
|
||||||
|
|
||||||
|
@ -2507,7 +2508,7 @@ declare namespace MatterJS {
|
||||||
* @method rotate
|
* @method rotate
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {number} rotation
|
* @param {number} rotation
|
||||||
* @param {boolean} [updateVelocity]
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
rotate (body: BodyType, rotation: number, updateVelocity?: boolean): void;
|
rotate (body: BodyType, rotation: number, updateVelocity?: boolean): void;
|
||||||
|
|
||||||
|
@ -2608,18 +2609,18 @@ declare namespace MatterJS {
|
||||||
* @method setPosition
|
* @method setPosition
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {vector} position
|
* @param {vector} position
|
||||||
* @param {boolean} updateVelocity
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
setPosition (body: BodyType, position: Vector, updateVelocity: boolean): void;
|
setPosition (body: BodyType, position: Vector, updateVelocity?: boolean): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged.
|
* Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged.
|
||||||
* @method setAngle
|
* @method setAngle
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {number} angle
|
* @param {number} angle
|
||||||
* @param {boolean} updateVelocity
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
setAngle (body: BodyType, angle: number, updateVelocity: boolean): void;
|
setAngle (body: BodyType, angle: number, updateVelocity?: boolean): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`.
|
* Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`.
|
||||||
|
@ -2668,7 +2669,7 @@ declare namespace MatterJS {
|
||||||
* @method translate
|
* @method translate
|
||||||
* @param {body} body
|
* @param {body} body
|
||||||
* @param {vector} translation
|
* @param {vector} translation
|
||||||
* @param {boolean} [updateVelocity]
|
* @param {boolean} [updateVelocity=false]
|
||||||
*/
|
*/
|
||||||
translate (body: BodyType, translation: Vector, updateVelocity?: boolean): void;
|
translate (body: BodyType, translation: Vector, updateVelocity?: boolean): void;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue