Skip to content

Commit

Permalink
fix issue with Bodies.circle label option, closes #195
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Feb 7, 2016
1 parent 490d232 commit e7e8c26
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/factory/Bodies.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,21 @@ var Vector = require('../geometry/Vector');
*/
Bodies.circle = function(x, y, radius, options, maxSides) {
options = options || {};
options.label = 'Circle Body';

var circle = {
label: 'Circle Body',
circleRadius: radius
};

// approximate circles with polygons until true circles implemented in SAT

maxSides = maxSides || 25;
var sides = Math.ceil(Math.max(10, Math.min(maxSides, radius)));

// optimisation: always use even number of sides (half the number of unique axes)
if (sides % 2 === 1)
sides += 1;

// flag for better rendering
options.circleRadius = radius;

return Bodies.polygon(x, y, sides, radius, options);
return Bodies.polygon(x, y, sides, radius, Common.extend({}, circle, options));
};

/**
Expand Down

0 comments on commit e7e8c26

Please sign in to comment.