@eva/plugin-matterjs 1.1.1-alpha.0 → 1.1.1-fix.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/plugin-matterjs.cjs.js +86 -83
- package/dist/plugin-matterjs.cjs.prod.js +2 -2
- package/dist/plugin-matterjs.esm.js +86 -83
- package/index.js +3 -3
- package/package.json +2 -2
- package/dist/EVA.plugin.renderer.matterjs.js +0 -11133
- package/dist/EVA.plugin.renderer.matterjs.min.js +0 -1
- package/dist/examples/index.d.ts +0 -2
- package/dist/examples/index.d.ts.map +0 -1
- package/dist/examples/src/a11y.d.ts +0 -3
- package/dist/examples/src/a11y.d.ts.map +0 -1
- package/dist/examples/src/component.d.ts +0 -3
- package/dist/examples/src/component.d.ts.map +0 -1
- package/dist/examples/src/compressed-texture.d.ts +0 -1
- package/dist/examples/src/compressed-texture.d.ts.map +0 -1
- package/dist/examples/src/dragonbone.d.ts +0 -3
- package/dist/examples/src/dragonbone.d.ts.map +0 -1
- package/dist/examples/src/event.d.ts +0 -3
- package/dist/examples/src/event.d.ts.map +0 -1
- package/dist/examples/src/graphics.d.ts +0 -3
- package/dist/examples/src/graphics.d.ts.map +0 -1
- package/dist/examples/src/image.d.ts +0 -3
- package/dist/examples/src/image.d.ts.map +0 -1
- package/dist/examples/src/loader.d.ts +0 -3
- package/dist/examples/src/loader.d.ts.map +0 -1
- package/dist/examples/src/lottie.d.ts +0 -3
- package/dist/examples/src/lottie.d.ts.map +0 -1
- package/dist/examples/src/mask.d.ts +0 -4
- package/dist/examples/src/mask.d.ts.map +0 -1
- package/dist/examples/src/matter.d.ts +0 -3
- package/dist/examples/src/matter.d.ts.map +0 -1
- package/dist/examples/src/multi-canvas.d.ts +0 -3
- package/dist/examples/src/multi-canvas.d.ts.map +0 -1
- package/dist/examples/src/ninePatch.d.ts +0 -3
- package/dist/examples/src/ninePatch.d.ts.map +0 -1
- package/dist/examples/src/sound.d.ts +0 -3
- package/dist/examples/src/sound.d.ts.map +0 -1
- package/dist/examples/src/spine.d.ts +0 -3
- package/dist/examples/src/spine.d.ts.map +0 -1
- package/dist/examples/src/sprite.d.ts +0 -3
- package/dist/examples/src/sprite.d.ts.map +0 -1
- package/dist/examples/src/spriteAnimation.d.ts +0 -3
- package/dist/examples/src/spriteAnimation.d.ts.map +0 -1
- package/dist/examples/src/text.d.ts +0 -3
- package/dist/examples/src/text.d.ts.map +0 -1
- package/dist/examples/src/tilingSprite.d.ts +0 -3
- package/dist/examples/src/tilingSprite.d.ts.map +0 -1
- package/dist/examples/src/transition.d.ts +0 -3
- package/dist/examples/src/transition.d.ts.map +0 -1
- package/dist/plugin-matterjs.d.ts +0 -35
package/README.md
CHANGED
|
@@ -95,7 +95,7 @@ const main = function () {
|
|
|
95
95
|
/******/
|
|
96
96
|
/******/ /******/ __webpack_require__.d = function (exports, name, getter) {
|
|
97
97
|
/******/ if (!__webpack_require__.o(exports, name)) {
|
|
98
|
-
/******/ Object.defineProperty(exports, name, {enumerable: true, get: getter});
|
|
98
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
99
99
|
/******/
|
|
100
100
|
}
|
|
101
101
|
/******/
|
|
@@ -103,10 +103,10 @@ const main = function () {
|
|
|
103
103
|
/******/
|
|
104
104
|
/******/ /******/ __webpack_require__.r = function (exports) {
|
|
105
105
|
/******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
106
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'});
|
|
106
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
107
107
|
/******/
|
|
108
108
|
}
|
|
109
|
-
/******/ Object.defineProperty(exports, '__esModule', {value: true});
|
|
109
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
110
110
|
/******/
|
|
111
111
|
}; // create a fake namespace object // mode & 1: value is a module id, require it // mode & 2: merge all properties of value into the ns // mode & 4: return value when already ns object // mode & 8|1: behave like require
|
|
112
112
|
/******/
|
|
@@ -116,7 +116,7 @@ const main = function () {
|
|
|
116
116
|
/******/ if (mode & 4 && typeof value === 'object' && value && value.__esModule) return value;
|
|
117
117
|
/******/ var ns = Object.create(null);
|
|
118
118
|
/******/ __webpack_require__.r(ns);
|
|
119
|
-
/******/ Object.defineProperty(ns, 'default', {enumerable: true, value: value});
|
|
119
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
120
120
|
/******/ if (mode & 2 && typeof value != 'string')
|
|
121
121
|
for (var key in value)
|
|
122
122
|
__webpack_require__.d(
|
|
@@ -708,8 +708,8 @@ const main = function () {
|
|
|
708
708
|
*/
|
|
709
709
|
Bounds.create = function (vertices) {
|
|
710
710
|
var bounds = {
|
|
711
|
-
min: {x: 0, y: 0},
|
|
712
|
-
max: {x: 0, y: 0},
|
|
711
|
+
min: { x: 0, y: 0 },
|
|
712
|
+
max: { x: 0, y: 0 },
|
|
713
713
|
};
|
|
714
714
|
|
|
715
715
|
if (vertices) Bounds.update(bounds, vertices);
|
|
@@ -841,7 +841,7 @@ const main = function () {
|
|
|
841
841
|
* @return {vector} A new vector
|
|
842
842
|
*/
|
|
843
843
|
Vector.create = function (x, y) {
|
|
844
|
-
return {x: x || 0, y: y || 0};
|
|
844
|
+
return { x: x || 0, y: y || 0 };
|
|
845
845
|
};
|
|
846
846
|
|
|
847
847
|
/**
|
|
@@ -851,7 +851,7 @@ const main = function () {
|
|
|
851
851
|
* @return {vector} A new cloned vector
|
|
852
852
|
*/
|
|
853
853
|
Vector.clone = function (vector) {
|
|
854
|
-
return {x: vector.x, y: vector.y};
|
|
854
|
+
return { x: vector.x, y: vector.y };
|
|
855
855
|
};
|
|
856
856
|
|
|
857
857
|
/**
|
|
@@ -919,8 +919,8 @@ const main = function () {
|
|
|
919
919
|
*/
|
|
920
920
|
Vector.normalise = function (vector) {
|
|
921
921
|
var magnitude = Vector.magnitude(vector);
|
|
922
|
-
if (magnitude === 0) return {x: 0, y: 0};
|
|
923
|
-
return {x: vector.x / magnitude, y: vector.y / magnitude};
|
|
922
|
+
if (magnitude === 0) return { x: 0, y: 0 };
|
|
923
|
+
return { x: vector.x / magnitude, y: vector.y / magnitude };
|
|
924
924
|
};
|
|
925
925
|
|
|
926
926
|
/**
|
|
@@ -997,7 +997,7 @@ const main = function () {
|
|
|
997
997
|
* @return {vector} A new vector multiplied by scalar
|
|
998
998
|
*/
|
|
999
999
|
Vector.mult = function (vector, scalar) {
|
|
1000
|
-
return {x: vector.x * scalar, y: vector.y * scalar};
|
|
1000
|
+
return { x: vector.x * scalar, y: vector.y * scalar };
|
|
1001
1001
|
};
|
|
1002
1002
|
|
|
1003
1003
|
/**
|
|
@@ -1008,7 +1008,7 @@ const main = function () {
|
|
|
1008
1008
|
* @return {vector} A new vector divided by scalar
|
|
1009
1009
|
*/
|
|
1010
1010
|
Vector.div = function (vector, scalar) {
|
|
1011
|
-
return {x: vector.x / scalar, y: vector.y / scalar};
|
|
1011
|
+
return { x: vector.x / scalar, y: vector.y / scalar };
|
|
1012
1012
|
};
|
|
1013
1013
|
|
|
1014
1014
|
/**
|
|
@@ -1020,7 +1020,7 @@ const main = function () {
|
|
|
1020
1020
|
*/
|
|
1021
1021
|
Vector.perp = function (vector, negate) {
|
|
1022
1022
|
negate = negate === true ? -1 : 1;
|
|
1023
|
-
return {x: negate * -vector.y, y: negate * vector.x};
|
|
1023
|
+
return { x: negate * -vector.y, y: negate * vector.x };
|
|
1024
1024
|
};
|
|
1025
1025
|
|
|
1026
1026
|
/**
|
|
@@ -1030,7 +1030,7 @@ const main = function () {
|
|
|
1030
1030
|
* @return {vector} The negated vector
|
|
1031
1031
|
*/
|
|
1032
1032
|
Vector.neg = function (vector) {
|
|
1033
|
-
return {x: -vector.x, y: -vector.y};
|
|
1033
|
+
return { x: -vector.x, y: -vector.y };
|
|
1034
1034
|
};
|
|
1035
1035
|
|
|
1036
1036
|
/**
|
|
@@ -1132,7 +1132,7 @@ const main = function () {
|
|
|
1132
1132
|
points = [];
|
|
1133
1133
|
|
|
1134
1134
|
path.replace(pathPattern, function (match, x, y) {
|
|
1135
|
-
points.push({x: parseFloat(x), y: parseFloat(y)});
|
|
1135
|
+
points.push({ x: parseFloat(x), y: parseFloat(y) });
|
|
1136
1136
|
});
|
|
1137
1137
|
|
|
1138
1138
|
return Vertices.create(points, body);
|
|
@@ -1146,7 +1146,7 @@ const main = function () {
|
|
|
1146
1146
|
*/
|
|
1147
1147
|
Vertices.centre = function (vertices) {
|
|
1148
1148
|
var area = Vertices.area(vertices, true),
|
|
1149
|
-
centre = {x: 0, y: 0},
|
|
1149
|
+
centre = { x: 0, y: 0 },
|
|
1150
1150
|
cross,
|
|
1151
1151
|
temp,
|
|
1152
1152
|
j;
|
|
@@ -1168,7 +1168,7 @@ const main = function () {
|
|
|
1168
1168
|
* @return {vector} The average point
|
|
1169
1169
|
*/
|
|
1170
1170
|
Vertices.mean = function (vertices) {
|
|
1171
|
-
var average = {x: 0, y: 0};
|
|
1171
|
+
var average = { x: 0, y: 0 };
|
|
1172
1172
|
|
|
1173
1173
|
for (var i = 0; i < vertices.length; i++) {
|
|
1174
1174
|
average.x += vertices[i].x;
|
|
@@ -1707,7 +1707,7 @@ const main = function () {
|
|
|
1707
1707
|
Composite.add = function (composite, object) {
|
|
1708
1708
|
var objects = [].concat(object);
|
|
1709
1709
|
|
|
1710
|
-
Events.trigger(composite, 'beforeAdd', {object: object});
|
|
1710
|
+
Events.trigger(composite, 'beforeAdd', { object: object });
|
|
1711
1711
|
|
|
1712
1712
|
for (var i = 0; i < objects.length; i++) {
|
|
1713
1713
|
var obj = objects[i];
|
|
@@ -1734,7 +1734,7 @@ const main = function () {
|
|
|
1734
1734
|
}
|
|
1735
1735
|
}
|
|
1736
1736
|
|
|
1737
|
-
Events.trigger(composite, 'afterAdd', {object: object});
|
|
1737
|
+
Events.trigger(composite, 'afterAdd', { object: object });
|
|
1738
1738
|
|
|
1739
1739
|
return composite;
|
|
1740
1740
|
};
|
|
@@ -1752,7 +1752,7 @@ const main = function () {
|
|
|
1752
1752
|
Composite.remove = function (composite, object, deep) {
|
|
1753
1753
|
var objects = [].concat(object);
|
|
1754
1754
|
|
|
1755
|
-
Events.trigger(composite, 'beforeRemove', {object: object});
|
|
1755
|
+
Events.trigger(composite, 'beforeRemove', { object: object });
|
|
1756
1756
|
|
|
1757
1757
|
for (var i = 0; i < objects.length; i++) {
|
|
1758
1758
|
var obj = objects[i];
|
|
@@ -1773,7 +1773,7 @@ const main = function () {
|
|
|
1773
1773
|
}
|
|
1774
1774
|
}
|
|
1775
1775
|
|
|
1776
|
-
Events.trigger(composite, 'afterRemove', {object: object});
|
|
1776
|
+
Events.trigger(composite, 'afterRemove', { object: object });
|
|
1777
1777
|
|
|
1778
1778
|
return composite;
|
|
1779
1779
|
};
|
|
@@ -2359,15 +2359,15 @@ const main = function () {
|
|
|
2359
2359
|
plugin: {},
|
|
2360
2360
|
angle: 0,
|
|
2361
2361
|
vertices: Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'),
|
|
2362
|
-
position: {x: 0, y: 0},
|
|
2363
|
-
force: {x: 0, y: 0},
|
|
2362
|
+
position: { x: 0, y: 0 },
|
|
2363
|
+
force: { x: 0, y: 0 },
|
|
2364
2364
|
torque: 0,
|
|
2365
|
-
positionImpulse: {x: 0, y: 0},
|
|
2366
|
-
constraintImpulse: {x: 0, y: 0, angle: 0},
|
|
2365
|
+
positionImpulse: { x: 0, y: 0 },
|
|
2366
|
+
constraintImpulse: { x: 0, y: 0, angle: 0 },
|
|
2367
2367
|
totalContacts: 0,
|
|
2368
2368
|
speed: 0,
|
|
2369
2369
|
angularSpeed: 0,
|
|
2370
|
-
velocity: {x: 0, y: 0},
|
|
2370
|
+
velocity: { x: 0, y: 0 },
|
|
2371
2371
|
angularVelocity: 0,
|
|
2372
2372
|
isSensor: false,
|
|
2373
2373
|
isStatic: false,
|
|
@@ -2894,9 +2894,9 @@ const main = function () {
|
|
|
2894
2894
|
Body.setMass(part, body.density * part.area);
|
|
2895
2895
|
|
|
2896
2896
|
// update inertia (requires vertices to be at origin)
|
|
2897
|
-
Vertices.translate(part.vertices, {x: -part.position.x, y: -part.position.y});
|
|
2897
|
+
Vertices.translate(part.vertices, { x: -part.position.x, y: -part.position.y });
|
|
2898
2898
|
Body.setInertia(part, Body._inertiaScale * Vertices.inertia(part.vertices, part.mass));
|
|
2899
|
-
Vertices.translate(part.vertices, {x: part.position.x, y: part.position.y});
|
|
2899
|
+
Vertices.translate(part.vertices, { x: part.position.x, y: part.position.y });
|
|
2900
2900
|
|
|
2901
2901
|
if (i > 0) {
|
|
2902
2902
|
totalArea += part.area;
|
|
@@ -3001,7 +3001,7 @@ const main = function () {
|
|
|
3001
3001
|
Body.applyForce = function (body, position, force) {
|
|
3002
3002
|
body.force.x += force.x;
|
|
3003
3003
|
body.force.y += force.y;
|
|
3004
|
-
var offset = {x: position.x - body.position.x, y: position.y - body.position.y};
|
|
3004
|
+
var offset = { x: position.x - body.position.x, y: position.y - body.position.y };
|
|
3005
3005
|
body.torque += offset.x * force.y - offset.y * force.x;
|
|
3006
3006
|
};
|
|
3007
3007
|
|
|
@@ -3021,7 +3021,7 @@ const main = function () {
|
|
|
3021
3021
|
mass: 0,
|
|
3022
3022
|
area: 0,
|
|
3023
3023
|
inertia: 0,
|
|
3024
|
-
centre: {x: 0, y: 0},
|
|
3024
|
+
centre: { x: 0, y: 0 },
|
|
3025
3025
|
};
|
|
3026
3026
|
|
|
3027
3027
|
// sum the properties of all compound parts of the parent body
|
|
@@ -3718,8 +3718,8 @@ const main = function () {
|
|
|
3718
3718
|
var constraint = options;
|
|
3719
3719
|
|
|
3720
3720
|
// if bodies defined but no points, use body centre
|
|
3721
|
-
if (constraint.bodyA && !constraint.pointA) constraint.pointA = {x: 0, y: 0};
|
|
3722
|
-
if (constraint.bodyB && !constraint.pointB) constraint.pointB = {x: 0, y: 0};
|
|
3721
|
+
if (constraint.bodyA && !constraint.pointA) constraint.pointA = { x: 0, y: 0 };
|
|
3722
|
+
if (constraint.bodyB && !constraint.pointB) constraint.pointB = { x: 0, y: 0 };
|
|
3723
3723
|
|
|
3724
3724
|
// calculate static length using initial world space points
|
|
3725
3725
|
var initialPointA = constraint.bodyA
|
|
@@ -4488,8 +4488,8 @@ const main = function () {
|
|
|
4488
4488
|
|
|
4489
4489
|
// find bounds of all objects
|
|
4490
4490
|
var bounds = {
|
|
4491
|
-
min: {x: Infinity, y: Infinity},
|
|
4492
|
-
max: {x: -Infinity, y: -Infinity},
|
|
4491
|
+
min: { x: Infinity, y: Infinity },
|
|
4492
|
+
max: { x: -Infinity, y: -Infinity },
|
|
4493
4493
|
};
|
|
4494
4494
|
|
|
4495
4495
|
for (var i = 0; i < objects.length; i += 1) {
|
|
@@ -6299,7 +6299,7 @@ const main = function () {
|
|
|
6299
6299
|
// reuse collision object
|
|
6300
6300
|
collision = previousCollision;
|
|
6301
6301
|
} else {
|
|
6302
|
-
collision = {collided: false, bodyA: bodyA, bodyB: bodyB};
|
|
6302
|
+
collision = { collided: false, bodyA: bodyA, bodyB: bodyB };
|
|
6303
6303
|
}
|
|
6304
6304
|
|
|
6305
6305
|
if (previousCollision && canReusePrevCol) {
|
|
@@ -6412,7 +6412,7 @@ const main = function () {
|
|
|
6412
6412
|
SAT._overlapAxes = function (verticesA, verticesB, axes) {
|
|
6413
6413
|
var projectionA = Vector._temp[0],
|
|
6414
6414
|
projectionB = Vector._temp[1],
|
|
6415
|
-
result = {overlap: Number.MAX_VALUE},
|
|
6415
|
+
result = { overlap: Number.MAX_VALUE },
|
|
6416
6416
|
overlap,
|
|
6417
6417
|
axis;
|
|
6418
6418
|
|
|
@@ -6549,12 +6549,12 @@ const main = function () {
|
|
|
6549
6549
|
}
|
|
6550
6550
|
|
|
6551
6551
|
mouse.element = element || document.body;
|
|
6552
|
-
mouse.absolute = {x: 0, y: 0};
|
|
6553
|
-
mouse.position = {x: 0, y: 0};
|
|
6554
|
-
mouse.mousedownPosition = {x: 0, y: 0};
|
|
6555
|
-
mouse.mouseupPosition = {x: 0, y: 0};
|
|
6556
|
-
mouse.offset = {x: 0, y: 0};
|
|
6557
|
-
mouse.scale = {x: 1, y: 1};
|
|
6552
|
+
mouse.absolute = { x: 0, y: 0 };
|
|
6553
|
+
mouse.position = { x: 0, y: 0 };
|
|
6554
|
+
mouse.mousedownPosition = { x: 0, y: 0 };
|
|
6555
|
+
mouse.mouseupPosition = { x: 0, y: 0 };
|
|
6556
|
+
mouse.offset = { x: 0, y: 0 };
|
|
6557
|
+
mouse.scale = { x: 1, y: 1 };
|
|
6558
6558
|
mouse.wheelDelta = 0;
|
|
6559
6559
|
mouse.button = -1;
|
|
6560
6560
|
mouse.pixelRatio = parseInt(mouse.element.getAttribute('data-pixel-ratio'), 10) || 1;
|
|
@@ -6832,7 +6832,7 @@ const main = function () {
|
|
|
6832
6832
|
|
|
6833
6833
|
var rectangle = {
|
|
6834
6834
|
label: 'Rectangle Body',
|
|
6835
|
-
position: {x: x, y: y},
|
|
6835
|
+
position: { x: x, y: y },
|
|
6836
6836
|
vertices: Vertices.fromPath('L 0 0 L ' + width + ' 0 L ' + width + ' ' + height + ' L 0 ' + height),
|
|
6837
6837
|
};
|
|
6838
6838
|
|
|
@@ -6883,7 +6883,7 @@ const main = function () {
|
|
|
6883
6883
|
|
|
6884
6884
|
var trapezoid = {
|
|
6885
6885
|
label: 'Trapezoid Body',
|
|
6886
|
-
position: {x: x, y: y},
|
|
6886
|
+
position: { x: x, y: y },
|
|
6887
6887
|
vertices: Vertices.fromPath(verticesPath),
|
|
6888
6888
|
};
|
|
6889
6889
|
|
|
@@ -6963,7 +6963,7 @@ const main = function () {
|
|
|
6963
6963
|
|
|
6964
6964
|
var polygon = {
|
|
6965
6965
|
label: 'Polygon Body',
|
|
6966
|
-
position: {x: x, y: y},
|
|
6966
|
+
position: { x: x, y: y },
|
|
6967
6967
|
vertices: Vertices.fromPath(path),
|
|
6968
6968
|
};
|
|
6969
6969
|
|
|
@@ -7052,7 +7052,7 @@ const main = function () {
|
|
|
7052
7052
|
}
|
|
7053
7053
|
|
|
7054
7054
|
parts.push({
|
|
7055
|
-
position: {x: x, y: y},
|
|
7055
|
+
position: { x: x, y: y },
|
|
7056
7056
|
vertices: vertices,
|
|
7057
7057
|
});
|
|
7058
7058
|
} else {
|
|
@@ -7132,8 +7132,8 @@ const main = function () {
|
|
|
7132
7132
|
|
|
7133
7133
|
if (parts.length > 1) {
|
|
7134
7134
|
// create the parent body to be returned, that contains generated compound parts
|
|
7135
|
-
body = Body.create(Common.extend({parts: parts.slice(0)}, options));
|
|
7136
|
-
Body.setPosition(body, {x: x, y: y});
|
|
7135
|
+
body = Body.create(Common.extend({ parts: parts.slice(0) }, options));
|
|
7136
|
+
Body.setPosition(body, { x: x, y: y });
|
|
7137
7137
|
|
|
7138
7138
|
return body;
|
|
7139
7139
|
} else {
|
|
@@ -7611,8 +7611,8 @@ const main = function () {
|
|
|
7611
7611
|
scale: 0.001,
|
|
7612
7612
|
},
|
|
7613
7613
|
bounds: {
|
|
7614
|
-
min: {x: -Infinity, y: -Infinity},
|
|
7615
|
-
max: {x: Infinity, y: Infinity},
|
|
7614
|
+
min: { x: -Infinity, y: -Infinity },
|
|
7615
|
+
max: { x: Infinity, y: Infinity },
|
|
7616
7616
|
},
|
|
7617
7617
|
};
|
|
7618
7618
|
|
|
@@ -8334,7 +8334,7 @@ const main = function () {
|
|
|
8334
8334
|
engine.world = options.world || World.create(engine.world);
|
|
8335
8335
|
engine.pairs = Pairs.create();
|
|
8336
8336
|
engine.broadphase = engine.broadphase.controller.create(engine.broadphase);
|
|
8337
|
-
engine.metrics = engine.metrics || {extended: false};
|
|
8337
|
+
engine.metrics = engine.metrics || { extended: false };
|
|
8338
8338
|
|
|
8339
8339
|
// @if DEBUG
|
|
8340
8340
|
engine.metrics = Metrics.create(engine.metrics);
|
|
@@ -8435,7 +8435,7 @@ const main = function () {
|
|
|
8435
8435
|
|
|
8436
8436
|
// trigger collision events
|
|
8437
8437
|
if (pairs.collisionStart.length > 0)
|
|
8438
|
-
Events.trigger(engine, 'collisionStart', {pairs: pairs.collisionStart});
|
|
8438
|
+
Events.trigger(engine, 'collisionStart', { pairs: pairs.collisionStart });
|
|
8439
8439
|
|
|
8440
8440
|
// iteratively resolve position between collisions
|
|
8441
8441
|
Resolver.preSolvePosition(pairs.list);
|
|
@@ -8459,9 +8459,9 @@ const main = function () {
|
|
|
8459
8459
|
|
|
8460
8460
|
// trigger collision events
|
|
8461
8461
|
if (pairs.collisionActive.length > 0)
|
|
8462
|
-
Events.trigger(engine, 'collisionActive', {pairs: pairs.collisionActive});
|
|
8462
|
+
Events.trigger(engine, 'collisionActive', { pairs: pairs.collisionActive });
|
|
8463
8463
|
|
|
8464
|
-
if (pairs.collisionEnd.length > 0) Events.trigger(engine, 'collisionEnd', {pairs: pairs.collisionEnd});
|
|
8464
|
+
if (pairs.collisionEnd.length > 0) Events.trigger(engine, 'collisionEnd', { pairs: pairs.collisionEnd });
|
|
8465
8465
|
|
|
8466
8466
|
// @if DEBUG
|
|
8467
8467
|
// update metrics log
|
|
@@ -9060,7 +9060,7 @@ const main = function () {
|
|
|
9060
9060
|
rayLength = Vector.magnitude(Vector.sub(startPoint, endPoint)),
|
|
9061
9061
|
rayX = (endPoint.x + startPoint.x) * 0.5,
|
|
9062
9062
|
rayY = (endPoint.y + startPoint.y) * 0.5,
|
|
9063
|
-
ray = Bodies.rectangle(rayX, rayY, rayLength, rayWidth, {angle: rayAngle}),
|
|
9063
|
+
ray = Bodies.rectangle(rayX, rayY, rayLength, rayWidth, { angle: rayAngle }),
|
|
9064
9064
|
collisions = Query.collides(ray, bodies);
|
|
9065
9065
|
|
|
9066
9066
|
for (var i = 0; i < collisions.length; i += 1) {
|
|
@@ -9187,7 +9187,7 @@ const main = function () {
|
|
|
9187
9187
|
var constraint = Constraint.create({
|
|
9188
9188
|
label: 'Mouse Constraint',
|
|
9189
9189
|
pointA: mouse.position,
|
|
9190
|
-
pointB: {x: 0, y: 0},
|
|
9190
|
+
pointB: { x: 0, y: 0 },
|
|
9191
9191
|
length: 0.01,
|
|
9192
9192
|
stiffness: 0.1,
|
|
9193
9193
|
angularStiffness: 1,
|
|
@@ -9253,7 +9253,7 @@ const main = function () {
|
|
|
9253
9253
|
constraint.angleB = body.angle;
|
|
9254
9254
|
|
|
9255
9255
|
Sleeping.set(body, false);
|
|
9256
|
-
Events.trigger(mouseConstraint, 'startdrag', {mouse: mouse, body: body});
|
|
9256
|
+
Events.trigger(mouseConstraint, 'startdrag', { mouse: mouse, body: body });
|
|
9257
9257
|
|
|
9258
9258
|
break;
|
|
9259
9259
|
}
|
|
@@ -9268,7 +9268,7 @@ const main = function () {
|
|
|
9268
9268
|
constraint.bodyB = mouseConstraint.body = null;
|
|
9269
9269
|
constraint.pointB = null;
|
|
9270
9270
|
|
|
9271
|
-
if (body) Events.trigger(mouseConstraint, 'enddrag', {mouse: mouse, body: body});
|
|
9271
|
+
if (body) Events.trigger(mouseConstraint, 'enddrag', { mouse: mouse, body: body });
|
|
9272
9272
|
}
|
|
9273
9273
|
};
|
|
9274
9274
|
|
|
@@ -9282,11 +9282,11 @@ const main = function () {
|
|
|
9282
9282
|
var mouse = mouseConstraint.mouse,
|
|
9283
9283
|
mouseEvents = mouse.sourceEvents;
|
|
9284
9284
|
|
|
9285
|
-
if (mouseEvents.mousemove) Events.trigger(mouseConstraint, 'mousemove', {mouse: mouse});
|
|
9285
|
+
if (mouseEvents.mousemove) Events.trigger(mouseConstraint, 'mousemove', { mouse: mouse });
|
|
9286
9286
|
|
|
9287
|
-
if (mouseEvents.mousedown) Events.trigger(mouseConstraint, 'mousedown', {mouse: mouse});
|
|
9287
|
+
if (mouseEvents.mousedown) Events.trigger(mouseConstraint, 'mousedown', { mouse: mouse });
|
|
9288
9288
|
|
|
9289
|
-
if (mouseEvents.mouseup) Events.trigger(mouseConstraint, 'mouseup', {mouse: mouse});
|
|
9289
|
+
if (mouseEvents.mouseup) Events.trigger(mouseConstraint, 'mouseup', { mouse: mouse });
|
|
9290
9290
|
|
|
9291
9291
|
// reset the mouse state ready for the next step
|
|
9292
9292
|
Mouse.clearSourceEvents(mouse);
|
|
@@ -9774,7 +9774,7 @@ const main = function () {
|
|
|
9774
9774
|
* @return {composite} A new composite containing objects created in the callback
|
|
9775
9775
|
*/
|
|
9776
9776
|
Composites.stack = function (xx, yy, columns, rows, columnGap, rowGap, callback) {
|
|
9777
|
-
var stack = Composite.create({label: 'Stack'}),
|
|
9777
|
+
var stack = Composite.create({ label: 'Stack' }),
|
|
9778
9778
|
x = xx,
|
|
9779
9779
|
y = yy,
|
|
9780
9780
|
lastBody,
|
|
@@ -9792,7 +9792,7 @@ const main = function () {
|
|
|
9792
9792
|
|
|
9793
9793
|
if (bodyHeight > maxHeight) maxHeight = bodyHeight;
|
|
9794
9794
|
|
|
9795
|
-
Body.translate(body, {x: bodyWidth * 0.5, y: bodyHeight * 0.5});
|
|
9795
|
+
Body.translate(body, { x: bodyWidth * 0.5, y: bodyHeight * 0.5 });
|
|
9796
9796
|
|
|
9797
9797
|
x = body.bounds.max.x + columnGap;
|
|
9798
9798
|
|
|
@@ -9836,9 +9836,9 @@ const main = function () {
|
|
|
9836
9836
|
|
|
9837
9837
|
var defaults = {
|
|
9838
9838
|
bodyA: bodyA,
|
|
9839
|
-
pointA: {x: bodyAWidth * xOffsetA, y: bodyAHeight * yOffsetA},
|
|
9839
|
+
pointA: { x: bodyAWidth * xOffsetA, y: bodyAHeight * yOffsetA },
|
|
9840
9840
|
bodyB: bodyB,
|
|
9841
|
-
pointB: {x: bodyBWidth * xOffsetB, y: bodyBHeight * yOffsetB},
|
|
9841
|
+
pointB: { x: bodyBWidth * xOffsetB, y: bodyBHeight * yOffsetB },
|
|
9842
9842
|
};
|
|
9843
9843
|
|
|
9844
9844
|
var constraint = Common.extend(defaults, options);
|
|
@@ -9875,7 +9875,7 @@ const main = function () {
|
|
|
9875
9875
|
bodyB = bodies[col + row * columns];
|
|
9876
9876
|
Composite.addConstraint(
|
|
9877
9877
|
composite,
|
|
9878
|
-
Constraint.create(Common.extend({bodyA: bodyA, bodyB: bodyB}, options)),
|
|
9878
|
+
Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options)),
|
|
9879
9879
|
);
|
|
9880
9880
|
}
|
|
9881
9881
|
|
|
@@ -9885,14 +9885,14 @@ const main = function () {
|
|
|
9885
9885
|
bodyB = bodies[col + row * columns];
|
|
9886
9886
|
Composite.addConstraint(
|
|
9887
9887
|
composite,
|
|
9888
|
-
Constraint.create(Common.extend({bodyA: bodyA, bodyB: bodyB}, options)),
|
|
9888
|
+
Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options)),
|
|
9889
9889
|
);
|
|
9890
9890
|
|
|
9891
9891
|
if (crossBrace && col > 0) {
|
|
9892
9892
|
bodyC = bodies[col - 1 + (row - 1) * columns];
|
|
9893
9893
|
Composite.addConstraint(
|
|
9894
9894
|
composite,
|
|
9895
|
-
Constraint.create(Common.extend({bodyA: bodyC, bodyB: bodyB}, options)),
|
|
9895
|
+
Constraint.create(Common.extend({ bodyA: bodyC, bodyB: bodyB }, options)),
|
|
9896
9896
|
);
|
|
9897
9897
|
}
|
|
9898
9898
|
|
|
@@ -9900,7 +9900,7 @@ const main = function () {
|
|
|
9900
9900
|
bodyC = bodies[col + 1 + (row - 1) * columns];
|
|
9901
9901
|
Composite.addConstraint(
|
|
9902
9902
|
composite,
|
|
9903
|
-
Constraint.create(Common.extend({bodyA: bodyC, bodyB: bodyB}, options)),
|
|
9903
|
+
Constraint.create(Common.extend({ bodyA: bodyC, bodyB: bodyB }, options)),
|
|
9904
9904
|
);
|
|
9905
9905
|
}
|
|
9906
9906
|
}
|
|
@@ -9949,7 +9949,7 @@ const main = function () {
|
|
|
9949
9949
|
|
|
9950
9950
|
// retroactively fix the first body's position, since width was unknown
|
|
9951
9951
|
if (i === 1) {
|
|
9952
|
-
Body.translate(lastBody, {x: (column + (columns % 2 === 1 ? 1 : -1)) * lastBodyWidth, y: 0});
|
|
9952
|
+
Body.translate(lastBody, { x: (column + (columns % 2 === 1 ? 1 : -1)) * lastBodyWidth, y: 0 });
|
|
9953
9953
|
}
|
|
9954
9954
|
|
|
9955
9955
|
var xOffset = lastBody ? column * lastBodyWidth : 0;
|
|
@@ -9970,7 +9970,7 @@ const main = function () {
|
|
|
9970
9970
|
* @return {composite} A new composite newtonsCradle body
|
|
9971
9971
|
*/
|
|
9972
9972
|
Composites.newtonsCradle = function (xx, yy, number, size, length) {
|
|
9973
|
-
var newtonsCradle = Composite.create({label: 'Newtons Cradle'});
|
|
9973
|
+
var newtonsCradle = Composite.create({ label: 'Newtons Cradle' });
|
|
9974
9974
|
|
|
9975
9975
|
for (var i = 0; i < number; i++) {
|
|
9976
9976
|
var separation = 1.9,
|
|
@@ -9981,7 +9981,7 @@ const main = function () {
|
|
|
9981
9981
|
frictionAir: 0.0001,
|
|
9982
9982
|
slop: 1,
|
|
9983
9983
|
}),
|
|
9984
|
-
constraint = Constraint.create({pointA: {x: xx + i * (size * separation), y: yy}, bodyB: circle});
|
|
9984
|
+
constraint = Constraint.create({ pointA: { x: xx + i * (size * separation), y: yy }, bodyB: circle });
|
|
9985
9985
|
|
|
9986
9986
|
Composite.addBody(newtonsCradle, circle);
|
|
9987
9987
|
Composite.addConstraint(newtonsCradle, constraint);
|
|
@@ -10007,7 +10007,7 @@ const main = function () {
|
|
|
10007
10007
|
wheelBOffset = width * 0.5 - wheelBase,
|
|
10008
10008
|
wheelYOffset = 0;
|
|
10009
10009
|
|
|
10010
|
-
var car = Composite.create({label: 'Car'}),
|
|
10010
|
+
var car = Composite.create({ label: 'Car' }),
|
|
10011
10011
|
body = Bodies.rectangle(xx, yy, width, height, {
|
|
10012
10012
|
collisionFilter: {
|
|
10013
10013
|
group: group,
|
|
@@ -10034,7 +10034,7 @@ const main = function () {
|
|
|
10034
10034
|
|
|
10035
10035
|
var axelA = Constraint.create({
|
|
10036
10036
|
bodyB: body,
|
|
10037
|
-
pointB: {x: wheelAOffset, y: wheelYOffset},
|
|
10037
|
+
pointB: { x: wheelAOffset, y: wheelYOffset },
|
|
10038
10038
|
bodyA: wheelA,
|
|
10039
10039
|
stiffness: 1,
|
|
10040
10040
|
length: 0,
|
|
@@ -10042,7 +10042,7 @@ const main = function () {
|
|
|
10042
10042
|
|
|
10043
10043
|
var axelB = Constraint.create({
|
|
10044
10044
|
bodyB: body,
|
|
10045
|
-
pointB: {x: wheelBOffset, y: wheelYOffset},
|
|
10045
|
+
pointB: { x: wheelBOffset, y: wheelYOffset },
|
|
10046
10046
|
bodyA: wheelB,
|
|
10047
10047
|
stiffness: 1,
|
|
10048
10048
|
length: 0,
|
|
@@ -10084,9 +10084,9 @@ const main = function () {
|
|
|
10084
10084
|
particleOptions,
|
|
10085
10085
|
constraintOptions,
|
|
10086
10086
|
) {
|
|
10087
|
-
particleOptions = Common.extend({inertia: Infinity}, particleOptions);
|
|
10087
|
+
particleOptions = Common.extend({ inertia: Infinity }, particleOptions);
|
|
10088
10088
|
constraintOptions = Common.extend(
|
|
10089
|
-
{stiffness: 0.2, render: {type: 'line', anchors: false}},
|
|
10089
|
+
{ stiffness: 0.2, render: { type: 'line', anchors: false } },
|
|
10090
10090
|
constraintOptions,
|
|
10091
10091
|
);
|
|
10092
10092
|
|
|
@@ -10948,14 +10948,15 @@ var BodiesFactory = (function () {
|
|
|
10948
10948
|
};
|
|
10949
10949
|
};
|
|
10950
10950
|
return BodiesFactory;
|
|
10951
|
-
}());
|
|
10951
|
+
}());
|
|
10952
|
+
var BodiesFactory$1 = BodiesFactory;
|
|
10952
10953
|
|
|
10953
10954
|
var PhysicsEngine = (function () {
|
|
10954
10955
|
function PhysicsEngine(game, options) {
|
|
10955
10956
|
this.enabled = false;
|
|
10956
10957
|
this.Engine = Matter.Engine;
|
|
10957
10958
|
this.World = Matter.World;
|
|
10958
|
-
this.bodiesFatoty = new BodiesFactory();
|
|
10959
|
+
this.bodiesFatoty = new BodiesFactory$1();
|
|
10959
10960
|
this.Render = Matter.Render;
|
|
10960
10961
|
this.Runner = Matter.Runner;
|
|
10961
10962
|
this.Constraint = Matter.Constraint;
|
|
@@ -11056,7 +11057,8 @@ var PhysicsEngine = (function () {
|
|
|
11056
11057
|
});
|
|
11057
11058
|
};
|
|
11058
11059
|
return PhysicsEngine;
|
|
11059
|
-
}());
|
|
11060
|
+
}());
|
|
11061
|
+
var PhysicsEngine$1 = PhysicsEngine;
|
|
11060
11062
|
|
|
11061
11063
|
var PhysicsSystem = (function (_super) {
|
|
11062
11064
|
__extends(PhysicsSystem, _super);
|
|
@@ -11064,7 +11066,7 @@ var PhysicsSystem = (function (_super) {
|
|
|
11064
11066
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
11065
11067
|
}
|
|
11066
11068
|
PhysicsSystem.prototype.init = function (param) {
|
|
11067
|
-
this.engine = new PhysicsEngine(this.game, param);
|
|
11069
|
+
this.engine = new PhysicsEngine$1(this.game, param);
|
|
11068
11070
|
this.game.canvas.setAttribute('data-pixel-ratio', param.resolution || '1');
|
|
11069
11071
|
};
|
|
11070
11072
|
PhysicsSystem.prototype.awake = function () { };
|
|
@@ -11122,7 +11124,8 @@ var PhysicsSystem = (function (_super) {
|
|
|
11122
11124
|
})
|
|
11123
11125
|
], PhysicsSystem);
|
|
11124
11126
|
return PhysicsSystem;
|
|
11125
|
-
}(eva_js.System));
|
|
11127
|
+
}(eva_js.System));
|
|
11128
|
+
var PhysicsSystem$1 = PhysicsSystem;
|
|
11126
11129
|
|
|
11127
11130
|
exports.Physics = Physics;
|
|
11128
|
-
exports.PhysicsSystem = PhysicsSystem;
|
|
11131
|
+
exports.PhysicsSystem = PhysicsSystem$1;
|