Skip to content

Commit 894c1ef

Browse files
committed
fix point argument of Body.scale, closes #428
1 parent 3bceef4 commit 894c1ef

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/body/Body.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,17 @@ var Axes = require('../geometry/Axes');
521521
* @param {vector} [point]
522522
*/
523523
Body.scale = function(body, scaleX, scaleY, point) {
524+
point = point || body.position;
525+
524526
for (var i = 0; i < body.parts.length; i++) {
525527
var part = body.parts[i];
526528

529+
// scale position
530+
part.position.x = point.x + (part.position.x - point.x) * scaleX;
531+
part.position.y = point.y + (part.position.y - point.y) * scaleY;
532+
527533
// scale vertices
528-
Vertices.scale(part.vertices, scaleX, scaleY, body.position);
534+
Vertices.scale(part.vertices, scaleX, scaleY, point);
529535

530536
// update properties
531537
part.axes = Axes.fromVertices(part.vertices);

0 commit comments

Comments
 (0)