Skip to content

Commit 94e9614

Browse files
committed
fix decomp import in Bodies.fromVertices
1 parent 9ef9d02 commit 94e9614

2 files changed

Lines changed: 2 additions & 21 deletions

File tree

src/core/Common.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -535,19 +535,4 @@ module.exports = Common;
535535
func
536536
));
537537
};
538-
539-
/**
540-
* Used to require external libraries outside of the bundle.
541-
* It first looks for the `globalName` on the environment's global namespace.
542-
* If the global is not found, it will fall back to using the standard `require` using the `moduleName`.
543-
* @private
544-
* @method _requireGlobal
545-
* @param {string} globalName The global module name
546-
* @param {string} moduleName The fallback CommonJS module name
547-
* @return {} The loaded module
548-
*/
549-
Common._requireGlobal = function(globalName, moduleName) {
550-
var obj = (typeof window !== 'undefined' ? window[globalName] : typeof global !== 'undefined' ? global[globalName] : null);
551-
return obj || require(moduleName);
552-
};
553538
})();

src/factory/Bodies.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ var Common = require('../core/Common');
1818
var Body = require('../body/Body');
1919
var Bounds = require('../geometry/Bounds');
2020
var Vector = require('../geometry/Vector');
21-
var decomp;
2221

2322
(function() {
2423

@@ -197,11 +196,8 @@ var decomp;
197196
* @return {body}
198197
*/
199198
Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) {
200-
if (!decomp) {
201-
decomp = Common._requireGlobal('decomp', 'poly-decomp');
202-
}
203-
204-
var body,
199+
var decomp = typeof decomp !== 'undefined' ? decomp : require('poly-decomp'),
200+
body,
205201
parts,
206202
isConvex,
207203
vertices,

0 commit comments

Comments
 (0)