Skip to content

Commit

Permalink
fix Composite.bounds global issue, closes #627, closes #544
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Jun 11, 2018
1 parent 0cf97f5 commit f7f77b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/body/Composite.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = Composite;

var Events = require('../core/Events');
var Common = require('../core/Common');
var Bounds = require('../geometry/Bounds');
var Body = require('./Body');

(function() {
Expand Down Expand Up @@ -539,15 +540,15 @@ var Body = require('./Body');
* @returns {bounds} The composite bounds.
*/
Composite.bounds = function(composite) {
var bodies = Matter.Composite.allBodies(composite),
var bodies = Composite.allBodies(composite),
vertices = [];

for (var i = 0; i < bodies.length; i += 1) {
var body = bodies[i];
vertices.push(body.bounds.min, body.bounds.max);
}

return Matter.Bounds.create(vertices);
return Bounds.create(vertices);
};

/*
Expand Down

0 comments on commit f7f77b4

Please sign in to comment.