0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-01-12 16:08:50 -05:00

removed body.render.path

This commit is contained in:
liabru 2014-05-02 19:08:01 +01:00
parent bd84d4866e
commit f1db9df854
2 changed files with 4 additions and 11 deletions

View file

@ -23,6 +23,7 @@ var Body = {};
type: 'body',
label: 'Body',
angle: 0,
vertices: Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'),
position: { x: 0, y: 0 },
force: { x: 0, y: 0 },
torque: 0,
@ -49,7 +50,6 @@ var Body = {};
xScale: 1,
yScale: 1
},
path: 'L 0 0 L 40 0 L 40 40 L 0 40',
lineWidth: 1.5
}
};
@ -78,7 +78,6 @@ var Body = {};
*/
var _initProperties = function(body) {
// calculated properties
body.vertices = body.vertices || Vertices.fromPath(body.render.path);
body.axes = body.axes || Axes.fromVertices(body.vertices);
body.area = Vertices.area(body.vertices);
body.bounds = Bounds.create(body.vertices);

View file

@ -27,9 +27,7 @@ var Bodies = {};
var rectangle = {
label: 'Rectangle Body',
position: { x: x, y: y },
render: {
path: 'L 0 0 L ' + width + ' 0 L ' + width + ' ' + height + ' L 0 ' + height
}
vertices: Vertices.fromPath('L 0 0 L ' + width + ' 0 L ' + width + ' ' + height + ' L 0 ' + height)
};
return Body.create(Common.extend({}, rectangle, options));
@ -59,9 +57,7 @@ var Bodies = {};
var trapezoid = {
label: 'Trapezoid Body',
position: { x: x, y: y },
render: {
path: 'L 0 0 L ' + x1 + ' ' + (-height) + ' L ' + x2 + ' ' + (-height) + ' L ' + x3 + ' 0'
}
vertices: Vertices.fromPath('L 0 0 L ' + x1 + ' ' + (-height) + ' L ' + x2 + ' ' + (-height) + ' L ' + x3 + ' 0')
};
return Body.create(Common.extend({}, trapezoid, options));
@ -127,9 +123,7 @@ var Bodies = {};
var polygon = {
label: 'Polygon Body',
position: { x: x, y: y },
render: {
path: path
}
vertices: Vertices.fromPath(path)
};
return Body.create(Common.extend({}, polygon, options));