mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
fix decomp import in Bodies.fromVertices
This commit is contained in:
parent
9ef9d020c4
commit
94e9614436
2 changed files with 2 additions and 21 deletions
|
@ -535,19 +535,4 @@ module.exports = Common;
|
|||
func
|
||||
));
|
||||
};
|
||||
|
||||
/**
|
||||
* Used to require external libraries outside of the bundle.
|
||||
* It first looks for the `globalName` on the environment's global namespace.
|
||||
* If the global is not found, it will fall back to using the standard `require` using the `moduleName`.
|
||||
* @private
|
||||
* @method _requireGlobal
|
||||
* @param {string} globalName The global module name
|
||||
* @param {string} moduleName The fallback CommonJS module name
|
||||
* @return {} The loaded module
|
||||
*/
|
||||
Common._requireGlobal = function(globalName, moduleName) {
|
||||
var obj = (typeof window !== 'undefined' ? window[globalName] : typeof global !== 'undefined' ? global[globalName] : null);
|
||||
return obj || require(moduleName);
|
||||
};
|
||||
})();
|
||||
|
|
|
@ -18,7 +18,6 @@ var Common = require('../core/Common');
|
|||
var Body = require('../body/Body');
|
||||
var Bounds = require('../geometry/Bounds');
|
||||
var Vector = require('../geometry/Vector');
|
||||
var decomp;
|
||||
|
||||
(function() {
|
||||
|
||||
|
@ -197,11 +196,8 @@ var decomp;
|
|||
* @return {body}
|
||||
*/
|
||||
Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) {
|
||||
if (!decomp) {
|
||||
decomp = Common._requireGlobal('decomp', 'poly-decomp');
|
||||
}
|
||||
|
||||
var body,
|
||||
var decomp = typeof decomp !== 'undefined' ? decomp : require('poly-decomp'),
|
||||
body,
|
||||
parts,
|
||||
isConvex,
|
||||
vertices,
|
||||
|
|
Loading…
Reference in a new issue