0
0
Fork 0
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:
liabru 2020-03-13 22:08:39 +00:00
parent 5a0079df1b
commit 0af16455b9

View file

@ -196,7 +196,8 @@ var Vector = require('../geometry/Vector');
* @return {body} * @return {body}
*/ */
Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) { 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, body,
parts, parts,
isConvex, isConvex,
@ -207,6 +208,12 @@ var Vector = require('../geometry/Vector');
v, v,
z; z;
try {
decomp = globals.decomp || require('poly-decomp');
} catch (e) {
// decomp is undefined
}
options = options || {}; options = options || {};
parts = []; parts = [];