0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-27 09:50:52 -05:00

fix lint issues

This commit is contained in:
liabru 2019-09-15 18:43:28 +01:00
parent 5b0d34b9e0
commit 9ca21c1862
8 changed files with 19 additions and 20 deletions

View file

@ -192,8 +192,7 @@ var Axes = require('../geometry/Axes');
} }
for (property in settings) { for (property in settings) {
if (!Object.prototype.hasOwnProperty.call(settings, property))
if (!settings.hasOwnProperty(property))
continue; continue;
value = settings[property]; value = settings[property];
@ -1162,7 +1161,7 @@ var Axes = require('../geometry/Axes');
* @default 1 * @default 1
*/ */
/** /**
* A `Number` that defines the offset in the x-axis for the sprite (normalised by texture width). * A `Number` that defines the offset in the x-axis for the sprite (normalised by texture width).
* *
* @property render.sprite.xOffset * @property render.sprite.xOffset
@ -1170,7 +1169,7 @@ var Axes = require('../geometry/Axes');
* @default 0 * @default 0
*/ */
/** /**
* A `Number` that defines the offset in the y-axis for the sprite (normalised by texture height). * A `Number` that defines the offset in the y-axis for the sprite (normalised by texture height).
* *
* @property render.sprite.yOffset * @property render.sprite.yOffset

View file

@ -440,8 +440,8 @@ var Body = require('./Body');
*/ */
Composite.rebase = function(composite) { Composite.rebase = function(composite) {
var objects = Composite.allBodies(composite) var objects = Composite.allBodies(composite)
.concat(Composite.allConstraints(composite)) .concat(Composite.allConstraints(composite))
.concat(Composite.allComposites(composite)); .concat(Composite.allComposites(composite));
for (var i = 0; i < objects.length; i++) { for (var i = 0; i < objects.length; i++) {
objects[i].id = Common.nextId(); objects[i].id = Common.nextId();

View file

@ -128,7 +128,7 @@ var Common = require('../core/Common');
* @return {world} The original world with the objects from composite added * @return {world} The original world with the objects from composite added
*/ */
/** /**
* An alias for Composite.addBody * An alias for Composite.addBody
* @method addBody * @method addBody
* @param {world} world * @param {world} world
@ -136,7 +136,7 @@ var Common = require('../core/Common');
* @return {world} The original world with the body added * @return {world} The original world with the body added
*/ */
/** /**
* An alias for Composite.addConstraint * An alias for Composite.addConstraint
* @method addConstraint * @method addConstraint
* @param {world} world * @param {world} world

View file

@ -45,7 +45,7 @@ var Vector = require('../geometry/Vector');
if (options.chamfer) { if (options.chamfer) {
var chamfer = options.chamfer; var chamfer = options.chamfer;
rectangle.vertices = Vertices.chamfer(rectangle.vertices, chamfer.radius, rectangle.vertices = Vertices.chamfer(rectangle.vertices, chamfer.radius,
chamfer.quality, chamfer.qualityMin, chamfer.qualityMax); chamfer.quality, chamfer.qualityMin, chamfer.qualityMax);
delete options.chamfer; delete options.chamfer;
} }
@ -91,7 +91,7 @@ var Vector = require('../geometry/Vector');
if (options.chamfer) { if (options.chamfer) {
var chamfer = options.chamfer; var chamfer = options.chamfer;
trapezoid.vertices = Vertices.chamfer(trapezoid.vertices, chamfer.radius, trapezoid.vertices = Vertices.chamfer(trapezoid.vertices, chamfer.radius,
chamfer.quality, chamfer.qualityMin, chamfer.qualityMax); chamfer.quality, chamfer.qualityMin, chamfer.qualityMax);
delete options.chamfer; delete options.chamfer;
} }
@ -168,7 +168,7 @@ var Vector = require('../geometry/Vector');
if (options.chamfer) { if (options.chamfer) {
var chamfer = options.chamfer; var chamfer = options.chamfer;
polygon.vertices = Vertices.chamfer(polygon.vertices, chamfer.radius, polygon.vertices = Vertices.chamfer(polygon.vertices, chamfer.radius,
chamfer.quality, chamfer.qualityMin, chamfer.qualityMax); chamfer.quality, chamfer.qualityMin, chamfer.qualityMax);
delete options.chamfer; delete options.chamfer;
} }

View file

@ -217,7 +217,7 @@ var Bodies = require('./Bodies');
for (var i = 0; i < number; i++) { for (var i = 0; i < number; i++) {
var separation = 1.9, var separation = 1.9,
circle = Bodies.circle(xx + i * (size * separation), yy + length, size, circle = Bodies.circle(xx + i * (size * separation), yy + length, size,
{ inertia: Infinity, restitution: 1, friction: 0, frictionAir: 0.0001, slop: 1 }), { inertia: Infinity, restitution: 1, friction: 0, frictionAir: 0.0001, slop: 1 }),
constraint = Constraint.create({ pointA: { x: xx + i * (size * separation), y: yy }, bodyB: circle }); constraint = Constraint.create({ pointA: { x: xx + i * (size * separation), y: yy }, bodyB: circle });
Composite.addBody(newtonsCradle, circle); Composite.addBody(newtonsCradle, circle);

View file

@ -70,7 +70,7 @@ var Common = require('../core/Common');
* @return {vertices} vertices * @return {vertices} vertices
*/ */
Vertices.fromPath = function(path, body) { Vertices.fromPath = function(path, body) {
var pathPattern = /L?\s*([\-\d\.e]+)[\s,]*([\-\d\.e]+)*/ig, var pathPattern = /L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/ig,
points = []; points = [];
path.replace(pathPattern, function(match, x, y) { path.replace(pathPattern, function(match, x, y) {

View file

@ -927,7 +927,7 @@ var Mouse = require('../core/Mouse');
// render a single axis indicator // render a single axis indicator
c.moveTo(part.position.x, part.position.y); c.moveTo(part.position.x, part.position.y);
c.lineTo((part.vertices[0].x + part.vertices[part.vertices.length-1].x) / 2, c.lineTo((part.vertices[0].x + part.vertices[part.vertices.length-1].x) / 2,
(part.vertices[0].y + part.vertices[part.vertices.length-1].y) / 2); (part.vertices[0].y + part.vertices[part.vertices.length-1].y) / 2);
} }
} }
} }
@ -1227,9 +1227,9 @@ var Mouse = require('../core/Mouse');
var region = bucketId.split(/C|R/); var region = bucketId.split(/C|R/);
c.rect(0.5 + parseInt(region[1], 10) * grid.bucketWidth, c.rect(0.5 + parseInt(region[1], 10) * grid.bucketWidth,
0.5 + parseInt(region[2], 10) * grid.bucketHeight, 0.5 + parseInt(region[2], 10) * grid.bucketHeight,
grid.bucketWidth, grid.bucketWidth,
grid.bucketHeight); grid.bucketHeight);
} }
c.lineWidth = 1; c.lineWidth = 1;
@ -1276,7 +1276,7 @@ var Mouse = require('../core/Mouse');
bounds = item.bounds; bounds = item.bounds;
context.beginPath(); context.beginPath();
context.rect(Math.floor(bounds.min.x - 3), Math.floor(bounds.min.y - 3), context.rect(Math.floor(bounds.min.x - 3), Math.floor(bounds.min.y - 3),
Math.floor(bounds.max.x - bounds.min.x + 6), Math.floor(bounds.max.y - bounds.min.y + 6)); Math.floor(bounds.max.x - bounds.min.x + 6), Math.floor(bounds.max.y - bounds.min.y + 6));
context.closePath(); context.closePath();
context.stroke(); context.stroke();
@ -1310,7 +1310,7 @@ var Mouse = require('../core/Mouse');
bounds = inspector.selectBounds; bounds = inspector.selectBounds;
context.beginPath(); context.beginPath();
context.rect(Math.floor(bounds.min.x), Math.floor(bounds.min.y), context.rect(Math.floor(bounds.min.x), Math.floor(bounds.min.y),
Math.floor(bounds.max.x - bounds.min.x), Math.floor(bounds.max.y - bounds.min.y)); Math.floor(bounds.max.x - bounds.min.x), Math.floor(bounds.max.y - bounds.min.y));
context.closePath(); context.closePath();
context.stroke(); context.stroke();
context.fill(); context.fill();

View file

@ -485,7 +485,7 @@ var Vector = require('../geometry/Vector');
primitive.moveTo(part.position.x - body.position.x, part.position.y - body.position.y); primitive.moveTo(part.position.x - body.position.x, part.position.y - body.position.y);
primitive.lineTo(((part.vertices[0].x + part.vertices[part.vertices.length-1].x) / 2 - body.position.x), primitive.lineTo(((part.vertices[0].x + part.vertices[part.vertices.length-1].x) / 2 - body.position.x),
((part.vertices[0].y + part.vertices[part.vertices.length-1].y) / 2 - body.position.y)); ((part.vertices[0].y + part.vertices[part.vertices.length-1].y) / 2 - body.position.y));
primitive.endFill(); primitive.endFill();
} }