mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-24 13:29:01 -05:00
fix decomp require
This commit is contained in:
parent
5a0079df1b
commit
0af16455b9
1 changed files with 8 additions and 1 deletions
|
@ -196,7 +196,8 @@ var Vector = require('../geometry/Vector');
|
|||
* @return {body}
|
||||
*/
|
||||
Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) {
|
||||
var decomp = global.decomp || require('poly-decomp'),
|
||||
var globals = typeof global !== 'undefined' ? global : window,
|
||||
decomp,
|
||||
body,
|
||||
parts,
|
||||
isConvex,
|
||||
|
@ -207,6 +208,12 @@ var Vector = require('../geometry/Vector');
|
|||
v,
|
||||
z;
|
||||
|
||||
try {
|
||||
decomp = globals.decomp || require('poly-decomp');
|
||||
} catch (e) {
|
||||
// decomp is undefined
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
parts = [];
|
||||
|
||||
|
|
Loading…
Reference in a new issue