From e7e8c2610ea4522ef65ff6617336acd0fabce0fb Mon Sep 17 00:00:00 2001 From: liabru Date: Sun, 7 Feb 2016 16:22:20 +0000 Subject: [PATCH] fix issue with Bodies.circle label option, closes #195 --- src/factory/Bodies.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/factory/Bodies.js b/src/factory/Bodies.js index 78ef5ecc..c5f2588b 100644 --- a/src/factory/Bodies.js +++ b/src/factory/Bodies.js @@ -112,10 +112,13 @@ 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))); @@ -123,10 +126,7 @@ var Vector = require('../geometry/Vector'); 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)); }; /**