Skip to content

Commit

Permalink
liabru#544 Replace references to global Matter in Composite.bounds()
Browse files Browse the repository at this point in the history
  • Loading branch information
yellcorp committed Dec 19, 2017
1 parent b5dc3b2 commit 2effcdf
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 @@ -16,6 +16,7 @@ module.exports = Composite;
var Events = require('../core/Events');
var Common = require('../core/Common');
var Body = require('./Body');
var Bounds = require('../geometry/Bounds');

(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 2effcdf

Please sign in to comment.