mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
fix point
argument of Body.scale, closes #428
This commit is contained in:
parent
3bceef4f7e
commit
894c1efeee
1 changed files with 7 additions and 1 deletions
|
@ -521,11 +521,17 @@ var Axes = require('../geometry/Axes');
|
|||
* @param {vector} [point]
|
||||
*/
|
||||
Body.scale = function(body, scaleX, scaleY, point) {
|
||||
point = point || body.position;
|
||||
|
||||
for (var i = 0; i < body.parts.length; i++) {
|
||||
var part = body.parts[i];
|
||||
|
||||
// scale position
|
||||
part.position.x = point.x + (part.position.x - point.x) * scaleX;
|
||||
part.position.y = point.y + (part.position.y - point.y) * scaleY;
|
||||
|
||||
// scale vertices
|
||||
Vertices.scale(part.vertices, scaleX, scaleY, body.position);
|
||||
Vertices.scale(part.vertices, scaleX, scaleY, point);
|
||||
|
||||
// update properties
|
||||
part.axes = Axes.fromVertices(part.vertices);
|
||||
|
|
Loading…
Reference in a new issue