11/**
2- * matter-js 0.14.1 by @liabru 2018-01-10
2+ * matter-js 0.14.2 by @liabru 2018-06-11
33* http://brm.io/matter-js/
44* License MIT
55*/
2828 * THE SOFTWARE.
2929 */
3030
31- ( function ( f ) { if ( typeof exports === "object" && typeof module !== "undefined" ) { module . exports = f ( ) } else if ( typeof define === "function" && define . amd ) { define ( [ ] , f ) } else { var g ; if ( typeof window !== "undefined" ) { g = window } else if ( typeof global !== "undefined" ) { g = global } else if ( typeof self !== "undefined" ) { g = self } else { g = this } g . Matter = f ( ) } } ) ( function ( ) { var define , module , exports ; return ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ? n : e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( _dereq_ , module , exports ) {
31+ ( function ( f ) { if ( typeof exports === "object" && typeof module !== "undefined" ) { module . exports = f ( ) } else if ( typeof define === "function" && define . amd ) { define ( [ ] , f ) } else { var g ; if ( typeof window !== "undefined" ) { g = window } else if ( typeof global !== "undefined" ) { g = global } else if ( typeof self !== "undefined" ) { g = self } else { g = this } g . Matter = f ( ) } } ) ( function ( ) { var define , module , exports ; return ( function ( ) { function r ( e , n , t ) { function o ( i , f ) { if ( ! n [ i ] ) { if ( ! e [ i ] ) { var c = "function" == typeof require && require ; if ( ! f && c ) return c ( i , ! 0 ) ; if ( u ) return u ( i , ! 0 ) ; var a = new Error ( "Cannot find module '" + i + "'" ) ; throw a . code = "MODULE_NOT_FOUND" , a } var p = n [ i ] = { exports :{ } } ; e [ i ] [ 0 ] . call ( p . exports , function ( r ) { var n = e [ i ] [ 1 ] [ r ] ; return o ( n || r ) } , p , p . exports , r , e , n , t ) } return n [ i ] . exports } for ( var u = "function" == typeof require && require , i = 0 ; i < t . length ; i ++ ) o ( t [ i ] ) ; return o } return r } ) ( ) ( { 1 :[ function ( _dereq_ , module , exports ) {
3232/**
3333* The `Matter.Body` module contains methods for creating and manipulating body models.
3434* A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`.
@@ -1240,6 +1240,7 @@ module.exports = Composite;
12401240
12411241var Events = _dereq_ ( '../core/Events' ) ;
12421242var Common = _dereq_ ( '../core/Common' ) ;
1243+ var Bounds = _dereq_ ( '../geometry/Bounds' ) ;
12431244var Body = _dereq_ ( './Body' ) ;
12441245
12451246( function ( ) {
@@ -1764,15 +1765,15 @@ var Body = _dereq_('./Body');
17641765 * @returns {bounds } The composite bounds.
17651766 */
17661767 Composite . bounds = function ( composite ) {
1767- var bodies = Matter . Composite . allBodies ( composite ) ,
1768+ var bodies = Composite . allBodies ( composite ) ,
17681769 vertices = [ ] ;
17691770
17701771 for ( var i = 0 ; i < bodies . length ; i += 1 ) {
17711772 var body = bodies [ i ] ;
17721773 vertices . push ( body . bounds . min , body . bounds . max ) ;
17731774 }
17741775
1775- return Matter . Bounds . create ( vertices ) ;
1776+ return Bounds . create ( vertices ) ;
17761777 } ;
17771778
17781779 /*
@@ -1908,7 +1909,7 @@ var Body = _dereq_('./Body');
19081909
19091910} ) ( ) ;
19101911
1911- } , { "../core/Common" :14 , "../core/Events" :16 , "./Body" :1 } ] , 3 :[ function ( _dereq_ , module , exports ) {
1912+ } , { "../core/Common" :14 , "../core/Events" :16 , "../geometry/Bounds" : 26 , ". /Body" :1 } ] , 3 :[ function ( _dereq_ , module , exports ) {
19121913/**
19131914* The `Matter.World` module contains methods for creating and manipulating the world composite.
19141915* A `Matter.World` is a `Matter.Composite` body, which is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`.
@@ -3953,7 +3954,7 @@ var Common = _dereq_('../core/Common');
39533954 */
39543955
39553956 /**
3956- * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA ` if defined, otherwise a world-space position.
3957+ * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyB ` if defined, otherwise a world-space position.
39573958 *
39583959 * @property pointB
39593960 * @type vector
@@ -4263,6 +4264,7 @@ var Bounds = _dereq_('../geometry/Bounds');
42634264} ) ( ) ;
42644265
42654266} , { "../body/Composite" :2 , "../collision/Detector" :5 , "../core/Common" :14 , "../core/Events" :16 , "../core/Mouse" :19 , "../core/Sleeping" :22 , "../geometry/Bounds" :26 , "../geometry/Vertices" :29 , "./Constraint" :12 } ] , 14 :[ function ( _dereq_ , module , exports ) {
4267+ ( function ( global ) {
42664268/**
42674269* The `Matter.Common` module contains utility functions that are common to all modules.
42684270*
@@ -4801,8 +4803,23 @@ module.exports = Common;
48014803 ) ) ;
48024804 } ;
48034805
4806+ /**
4807+ * Used to require external libraries outside of the bundle.
4808+ * It first looks for the `globalName` on the environment's global namespace.
4809+ * If the global is not found, it will fall back to using the standard `require` using the `moduleName`.
4810+ * @private
4811+ * @method _requireGlobal
4812+ * @param {string } globalName The global module name
4813+ * @param {string } moduleName The fallback CommonJS module name
4814+ * @return { } The loaded module
4815+ */
4816+ Common . _requireGlobal = function ( globalName , moduleName ) {
4817+ var obj = ( typeof window !== 'undefined' ? window [ globalName ] : typeof global !== 'undefined' ? global [ globalName ] : null ) ;
4818+ return obj || _dereq_ ( moduleName ) ;
4819+ } ;
48044820} ) ( ) ;
48054821
4822+ } ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
48064823} , { } ] , 15 :[ function ( _dereq_ , module , exports ) {
48074824/**
48084825* The `Matter.Engine` module contains methods for creating and manipulating engines.
@@ -5444,7 +5461,7 @@ var Common = _dereq_('./Common');
54445461 * @readOnly
54455462 * @type {String }
54465463 */
5447- Matter . version = '0.14.1 ' ;
5464+ Matter . version = '0.14.2 ' ;
54485465
54495466 /**
54505467 * A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`.
@@ -6517,7 +6534,6 @@ var Events = _dereq_('./Events');
65176534} ) ( ) ;
65186535
65196536} , { "./Events" :16 } ] , 23 :[ function ( _dereq_ , module , exports ) {
6520- ( function ( global ) {
65216537/**
65226538* The `Matter.Bodies` module contains factory methods for creating rigid body models
65236539* with commonly used body configurations (such as rectangles, circles and other polygons).
@@ -6538,7 +6554,7 @@ var Common = _dereq_('../core/Common');
65386554var Body = _dereq_ ( '../body/Body' ) ;
65396555var Bounds = _dereq_ ( '../geometry/Bounds' ) ;
65406556var Vector = _dereq_ ( '../geometry/Vector' ) ;
6541- var decomp = ( typeof window !== "undefined" ? window [ 'decomp' ] : typeof global !== "undefined" ? global [ 'decomp' ] : null ) ;
6557+ var decomp ;
65426558
65436559( function ( ) {
65446560
@@ -6717,6 +6733,10 @@ var decomp = (typeof window !== "undefined" ? window['decomp'] : typeof global !
67176733 * @return {body }
67186734 */
67196735 Bodies . fromVertices = function ( x , y , vertexSets , options , flagInternal , removeCollinear , minimumArea ) {
6736+ if ( ! decomp ) {
6737+ decomp = Common . _requireGlobal ( 'decomp' , 'poly-decomp' ) ;
6738+ }
6739+
67206740 var body ,
67216741 parts ,
67226742 isConvex ,
@@ -6850,7 +6870,6 @@ var decomp = (typeof window !== "undefined" ? window['decomp'] : typeof global !
68506870
68516871} ) ( ) ;
68526872
6853- } ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
68546873} , { "../body/Body" :1 , "../core/Common" :14 , "../geometry/Bounds" :26 , "../geometry/Vector" :28 , "../geometry/Vertices" :29 } ] , 24 :[ function ( _dereq_ , module , exports ) {
68556874/**
68566875* The `Matter.Composites` module contains factory methods for creating composite bodies
@@ -7384,6 +7403,7 @@ var Svg = {};
73847403module . exports = Svg ;
73857404
73867405var Bounds = _dereq_ ( '../geometry/Bounds' ) ;
7406+ var Common = _dereq_ ( '../core/Common' ) ;
73877407
73887408( function ( ) {
73897409
@@ -7392,12 +7412,17 @@ var Bounds = _dereq_('../geometry/Bounds');
73927412 * If the input path forms a concave shape, you must decompose the result into convex parts before use.
73937413 * See `Bodies.fromVertices` which provides support for this.
73947414 * Note that this function is not guaranteed to support complex paths (such as those with holes).
7415+ * You must load the `pathseg.js` polyfill on newer browsers.
73957416 * @method pathToVertices
73967417 * @param {SVGPathElement } path
73977418 * @param {Number } [sampleLength=15]
73987419 * @return {Vector[] } points
73997420 */
74007421 Svg . pathToVertices = function ( path , sampleLength ) {
7422+ if ( typeof window !== 'undefined' && ! ( 'SVGPathSeg' in window ) ) {
7423+ Common . warn ( 'Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.' ) ;
7424+ }
7425+
74017426 // https://github.com/wout/svg.topoly.js/blob/master/svg.topoly.js
74027427 var i , il , total , point , segment , segments ,
74037428 segmentsQueue , lastSegment ,
@@ -7589,7 +7614,7 @@ var Bounds = _dereq_('../geometry/Bounds');
75897614 } ;
75907615
75917616} ) ( ) ;
7592- } , { "../geometry/Bounds" :26 } ] , 28 :[ function ( _dereq_ , module , exports ) {
7617+ } , { "../core/Common" : 14 , "../ geometry/Bounds" :26 } ] , 28 :[ function ( _dereq_ , module , exports ) {
75937618/**
75947619* The `Matter.Vector` module contains methods for creating and manipulating vectors.
75957620* Vectors are the basis of all the geometry related operations in the engine.
@@ -7806,7 +7831,7 @@ module.exports = Vector;
78067831 } ;
78077832
78087833 /**
7809- * Returns the angle in radians between the two vectors relative to the x-axis.
7834+ * Returns the angle between the vector `vectorB - vectorA` and the x-axis in radians .
78107835 * @method angle
78117836 * @param {vector } vectorA
78127837 * @param {vector } vectorB
@@ -10333,4 +10358,4 @@ var Vector = _dereq_('../geometry/Vector');
1033310358} ) ( ) ;
1033410359
1033510360} , { "../body/Composite" :2 , "../core/Common" :14 , "../core/Events" :16 , "../geometry/Bounds" :26 , "../geometry/Vector" :28 } ] } , { } , [ 30 ] ) ( 30 )
10336- } ) ;
10361+ } ) ;
0 commit comments