diff --git a/src/body/Body.js b/src/body/Body.js index b0ca5c4..d4bef9f 100644 --- a/src/body/Body.js +++ b/src/body/Body.js @@ -1,11 +1,3 @@ -var Vertices = require('../geometry/Vertices'); -var Vector = require('../geometry/Vector'); -var Sleeping = require('../core/Sleeping'); -var Render = require('../render/Render'); -var Common = require('../core/Common'); -var Bounds = require('../geometry/Bounds'); -var Axes = require('../geometry/Axes'); - /** * The `Matter.Body` module contains methods for creating and manipulating body models. * A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`. @@ -21,6 +13,14 @@ var Body = {}; module.exports = Body; +var Vertices = require('../geometry/Vertices'); +var Vector = require('../geometry/Vector'); +var Sleeping = require('../core/Sleeping'); +var Render = require('../render/Render'); +var Common = require('../core/Common'); +var Bounds = require('../geometry/Bounds'); +var Axes = require('../geometry/Axes'); + (function() { Body._inertiaScale = 4; diff --git a/src/body/Composite.js b/src/body/Composite.js index 076353b..5819484 100644 --- a/src/body/Composite.js +++ b/src/body/Composite.js @@ -1,7 +1,3 @@ -var Events = require('../core/Events'); -var Common = require('../core/Common'); -var Body = require('./Body'); - /** * The `Matter.Composite` module contains methods for creating and manipulating composite bodies. * A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure. @@ -18,6 +14,10 @@ var Composite = {}; module.exports = Composite; +var Events = require('../core/Events'); +var Common = require('../core/Common'); +var Body = require('./Body'); + (function() { /** diff --git a/src/body/World.js b/src/body/World.js index 3823ed5..bcaa412 100644 --- a/src/body/World.js +++ b/src/body/World.js @@ -1,7 +1,3 @@ -var Composite = require('./Composite'); -var Constraint = require('../constraint/Constraint'); -var Common = require('../core/Common'); - /** * The `Matter.World` module contains methods for creating and manipulating the world composite. * A `Matter.World` is a `Matter.Composite` body, which is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`. @@ -20,6 +16,10 @@ var World = {}; module.exports = World; +var Composite = require('./Composite'); +var Constraint = require('../constraint/Constraint'); +var Common = require('../core/Common'); + (function() { /** diff --git a/src/collision/Detector.js b/src/collision/Detector.js index d6c79fb..719eb92 100644 --- a/src/collision/Detector.js +++ b/src/collision/Detector.js @@ -1,7 +1,3 @@ -var SAT = require('./SAT'); -var Pair = require('./Pair'); -var Bounds = require('../geometry/Bounds'); - /** * _Internal Class_, not generally used outside of the engine's internals. * @@ -14,6 +10,10 @@ var Detector = {}; module.exports = Detector; +var SAT = require('./SAT'); +var Pair = require('./Pair'); +var Bounds = require('../geometry/Bounds'); + (function() { /** diff --git a/src/collision/Grid.js b/src/collision/Grid.js index bac5fe7..783a4aa 100644 --- a/src/collision/Grid.js +++ b/src/collision/Grid.js @@ -1,7 +1,3 @@ -var Pair = require('./Pair'); -var Detector = require('./Detector'); -var Common = require('../core/Common'); - /** * See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js) * and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples. @@ -13,6 +9,10 @@ var Grid = {}; module.exports = Grid; +var Pair = require('./Pair'); +var Detector = require('./Detector'); +var Common = require('../core/Common'); + (function() { /** diff --git a/src/collision/Pair.js b/src/collision/Pair.js index dc58a27..bfa2da8 100644 --- a/src/collision/Pair.js +++ b/src/collision/Pair.js @@ -1,5 +1,3 @@ -var Contact = require('./Contact'); - /** * _Internal Class_, not generally used outside of the engine's internals. * @@ -10,6 +8,8 @@ var Pair = {}; module.exports = Pair; +var Contact = require('./Contact'); + (function() { /** diff --git a/src/collision/Pairs.js b/src/collision/Pairs.js index 3591d79..5796104 100644 --- a/src/collision/Pairs.js +++ b/src/collision/Pairs.js @@ -1,6 +1,3 @@ -var Pair = require('./Pair'); -var Common = require('../core/Common'); - /** * _Internal Class_, not generally used outside of the engine's internals. * @@ -11,6 +8,9 @@ var Pairs = {}; module.exports = Pairs; +var Pair = require('./Pair'); +var Common = require('../core/Common'); + (function() { var _pairMaxIdleLife = 1000; diff --git a/src/collision/Query.js b/src/collision/Query.js index 242f680..b5adf5d 100644 --- a/src/collision/Query.js +++ b/src/collision/Query.js @@ -1,9 +1,3 @@ -var Vector = require('../geometry/Vector'); -var SAT = require('./SAT'); -var Bounds = require('../geometry/Bounds'); -var Bodies = require('../factory/Bodies'); -var Vertices = require('../geometry/Vertices'); - /** * The `Matter.Query` module contains methods for performing collision queries. * @@ -14,6 +8,12 @@ var Query = {}; module.exports = Query; +var Vector = require('../geometry/Vector'); +var SAT = require('./SAT'); +var Bounds = require('../geometry/Bounds'); +var Bodies = require('../factory/Bodies'); +var Vertices = require('../geometry/Vertices'); + (function() { /** diff --git a/src/collision/Resolver.js b/src/collision/Resolver.js index 4399c95..8dc09c0 100644 --- a/src/collision/Resolver.js +++ b/src/collision/Resolver.js @@ -1,8 +1,3 @@ -var Vertices = require('../geometry/Vertices'); -var Vector = require('../geometry/Vector'); -var Common = require('../core/Common'); -var Bounds = require('../geometry/Bounds'); - /** * _Internal Class_, not generally used outside of the engine's internals. * @@ -13,6 +8,11 @@ var Resolver = {}; module.exports = Resolver; +var Vertices = require('../geometry/Vertices'); +var Vector = require('../geometry/Vector'); +var Common = require('../core/Common'); +var Bounds = require('../geometry/Bounds'); + (function() { Resolver._restingThresh = 4; diff --git a/src/collision/SAT.js b/src/collision/SAT.js index 376c5bb..8fe87e3 100644 --- a/src/collision/SAT.js +++ b/src/collision/SAT.js @@ -1,6 +1,3 @@ -var Vertices = require('../geometry/Vertices'); -var Vector = require('../geometry/Vector'); - /** * _Internal Class_, not generally used outside of the engine's internals. * @@ -13,6 +10,9 @@ var SAT = {}; module.exports = SAT; +var Vertices = require('../geometry/Vertices'); +var Vector = require('../geometry/Vector'); + (function() { /** diff --git a/src/constraint/Constraint.js b/src/constraint/Constraint.js index 4713256..ea72dcb 100644 --- a/src/constraint/Constraint.js +++ b/src/constraint/Constraint.js @@ -1,10 +1,3 @@ -var Vertices = require('../geometry/Vertices'); -var Vector = require('../geometry/Vector'); -var Sleeping = require('../core/Sleeping'); -var Bounds = require('../geometry/Bounds'); -var Axes = require('../geometry/Axes'); -var Common = require('../core/Common'); - /** * The `Matter.Constraint` module contains methods for creating and manipulating constraints. * Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). @@ -28,6 +21,13 @@ var Constraint = {}; module.exports = Constraint; +var Vertices = require('../geometry/Vertices'); +var Vector = require('../geometry/Vector'); +var Sleeping = require('../core/Sleeping'); +var Bounds = require('../geometry/Bounds'); +var Axes = require('../geometry/Axes'); +var Common = require('../core/Common'); + (function() { var _minLength = 0.000001, diff --git a/src/constraint/MouseConstraint.js b/src/constraint/MouseConstraint.js index 59ba345..4d243c6 100644 --- a/src/constraint/MouseConstraint.js +++ b/src/constraint/MouseConstraint.js @@ -1,13 +1,3 @@ -var Vertices = require('../geometry/Vertices'); -var Sleeping = require('../core/Sleeping'); -var Mouse = require('../core/Mouse'); -var Events = require('../core/Events'); -var Detector = require('../collision/Detector'); -var Constraint = require('./Constraint'); -var Composite = require('../body/Composite'); -var Common = require('../core/Common'); -var Bounds = require('../geometry/Bounds'); - /** * The `Matter.MouseConstraint` module contains methods for creating mouse constraints. * Mouse constraints are used for allowing user interaction, providing the ability to move bodies via the mouse or touch. @@ -22,6 +12,16 @@ var MouseConstraint = {}; module.exports = MouseConstraint; +var Vertices = require('../geometry/Vertices'); +var Sleeping = require('../core/Sleeping'); +var Mouse = require('../core/Mouse'); +var Events = require('../core/Events'); +var Detector = require('../collision/Detector'); +var Constraint = require('./Constraint'); +var Composite = require('../body/Composite'); +var Common = require('../core/Common'); +var Bounds = require('../geometry/Bounds'); + (function() { /** diff --git a/src/core/Engine.js b/src/core/Engine.js index 78680b0..f20b9d3 100644 --- a/src/core/Engine.js +++ b/src/core/Engine.js @@ -1,16 +1,3 @@ -var World = require('../body/World'); -var Sleeping = require('./Sleeping'); -var Resolver = require('../collision/Resolver'); -var Render = require('../render/Render'); -var Pairs = require('../collision/Pairs'); -var Metrics = require('./Metrics'); -var Grid = require('../collision/Grid'); -var Events = require('./Events'); -var Composite = require('../body/Composite'); -var Constraint = require('../constraint/Constraint'); -var Common = require('./Common'); -var Body = require('../body/Body'); - /** * The `Matter.Engine` module contains methods for creating and manipulating engines. * An engine is a controller that manages updating the simulation of the world. @@ -26,6 +13,19 @@ var Engine = {}; module.exports = Engine; +var World = require('../body/World'); +var Sleeping = require('./Sleeping'); +var Resolver = require('../collision/Resolver'); +var Render = require('../render/Render'); +var Pairs = require('../collision/Pairs'); +var Metrics = require('./Metrics'); +var Grid = require('../collision/Grid'); +var Events = require('./Events'); +var Composite = require('../body/Composite'); +var Constraint = require('../constraint/Constraint'); +var Common = require('./Common'); +var Body = require('../body/Body'); + (function() { /** diff --git a/src/core/Events.js b/src/core/Events.js index 359f3e1..5a7fd91 100644 --- a/src/core/Events.js +++ b/src/core/Events.js @@ -1,5 +1,3 @@ -var Common = require('./Common'); - /** * See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js) * and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples. @@ -11,6 +9,8 @@ var Events = {}; module.exports = Events; +var Common = require('./Common'); + (function() { /** diff --git a/src/core/Metrics.js b/src/core/Metrics.js index 204a183..4500a9f 100644 --- a/src/core/Metrics.js +++ b/src/core/Metrics.js @@ -1,7 +1,4 @@ // @if DEBUG -var Composite = require('../body/Composite'); -var Common = require('./Common'); - /** * _Internal Class_, not generally used outside of the engine's internals. * @@ -11,6 +8,9 @@ var Metrics = {}; module.exports = Metrics; +var Composite = require('../body/Composite'); +var Common = require('./Common'); + (function() { /** diff --git a/src/core/Mouse.js b/src/core/Mouse.js index 1aa7dca..7454560 100644 --- a/src/core/Mouse.js +++ b/src/core/Mouse.js @@ -1,5 +1,3 @@ -var Common = require('../core/Common'); - /** * _Internal Class_, not generally used outside of the engine's internals. * @@ -10,6 +8,8 @@ var Mouse = {}; module.exports = Mouse; +var Common = require('../core/Common'); + (function() { /** diff --git a/src/core/Runner.js b/src/core/Runner.js index 8c8121f..8068ebb 100644 --- a/src/core/Runner.js +++ b/src/core/Runner.js @@ -1,7 +1,3 @@ -var Events = require('./Events'); -var Engine = require('./Engine'); -var Common = require('./Common'); - /** * The `Matter.Runner` module is an optional utility which provides a game loop, * that handles updating and rendering a `Matter.Engine` for you within a browser. @@ -20,6 +16,10 @@ var Runner = {}; module.exports = Runner; +var Events = require('./Events'); +var Engine = require('./Engine'); +var Common = require('./Common'); + (function() { if (typeof window === 'undefined') { diff --git a/src/core/Sleeping.js b/src/core/Sleeping.js index 3ecad0c..7de6a97 100644 --- a/src/core/Sleeping.js +++ b/src/core/Sleeping.js @@ -1,5 +1,3 @@ -var Events = require('./Events'); - /** * _Internal Class_, not generally used outside of the engine's internals. * @@ -10,6 +8,8 @@ var Sleeping = {}; module.exports = Sleeping; +var Events = require('./Events'); + (function() { Sleeping._motionWakeThreshold = 0.18; diff --git a/src/factory/Bodies.js b/src/factory/Bodies.js index a698b11..bc77d75 100644 --- a/src/factory/Bodies.js +++ b/src/factory/Bodies.js @@ -1,9 +1,3 @@ -var Vertices = require('../geometry/Vertices'); -var Common = require('../core/Common'); -var Body = require('../body/Body'); -var Bounds = require('../geometry/Bounds'); -var Vector = require('../geometry/Vector'); - /** * The `Matter.Bodies` module contains factory methods for creating rigid body models * with commonly used body configurations (such as rectangles, circles and other polygons). @@ -20,6 +14,12 @@ var Bodies = {}; module.exports = Bodies; +var Vertices = require('../geometry/Vertices'); +var Common = require('../core/Common'); +var Body = require('../body/Body'); +var Bounds = require('../geometry/Bounds'); +var Vector = require('../geometry/Vector'); + (function() { /** diff --git a/src/factory/Composites.js b/src/factory/Composites.js index f01c5fb..e86c581 100644 --- a/src/factory/Composites.js +++ b/src/factory/Composites.js @@ -1,9 +1,3 @@ -var Composite = require('../body/Composite'); -var Constraint = require('../constraint/Constraint'); -var Common = require('../core/Common'); -var Body = require('../body/Body'); -var Bodies = require('./Bodies'); - /** * See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js) * and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples. @@ -15,6 +9,12 @@ var Composites = {}; module.exports = Composites; +var Composite = require('../body/Composite'); +var Constraint = require('../constraint/Constraint'); +var Common = require('../core/Common'); +var Body = require('../body/Body'); +var Bodies = require('./Bodies'); + (function() { /** diff --git a/src/geometry/Axes.js b/src/geometry/Axes.js index eba3135..e5a3d51 100644 --- a/src/geometry/Axes.js +++ b/src/geometry/Axes.js @@ -1,6 +1,3 @@ -var Vector = require('../geometry/Vector'); -var Common = require('../core/Common'); - /** * _Internal Class_, not generally used outside of the engine's internals. * @@ -11,6 +8,9 @@ var Axes = {}; module.exports = Axes; +var Vector = require('../geometry/Vector'); +var Common = require('../core/Common'); + (function() { /** diff --git a/src/geometry/Svg.js b/src/geometry/Svg.js index f78a9f4..9c8d549 100644 --- a/src/geometry/Svg.js +++ b/src/geometry/Svg.js @@ -1,5 +1,3 @@ -var Bounds = require('../geometry/Bounds'); - /** * The `Matter.Svg` module contains methods for converting SVG images into an array of vector points. * @@ -13,6 +11,8 @@ var Svg = {}; module.exports = Svg; +var Bounds = require('../geometry/Bounds'); + (function() { /** diff --git a/src/geometry/Vertices.js b/src/geometry/Vertices.js index f6ea829..ef57bef 100644 --- a/src/geometry/Vertices.js +++ b/src/geometry/Vertices.js @@ -1,6 +1,3 @@ -var Vector = require('../geometry/Vector'); -var Common = require('../core/Common'); - /** * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. @@ -16,6 +13,9 @@ var Vertices = {}; module.exports = Vertices; +var Vector = require('../geometry/Vector'); +var Common = require('../core/Common'); + (function() { /** diff --git a/src/render/Render.js b/src/render/Render.js index 2194e06..331c2a3 100644 --- a/src/render/Render.js +++ b/src/render/Render.js @@ -1,9 +1,3 @@ -var Common = require('../core/Common'); -var Composite = require('../body/Composite'); -var Bounds = require('../geometry/Bounds'); -var Events = require('../core/Events'); -var Grid = require('../collision/Grid'); - /** * The `Matter.Render` module is the default `render.controller` used by a `Matter.Engine`. * This renderer is HTML5 canvas based and supports a number of drawing options including sprites and viewports. @@ -20,6 +14,12 @@ var Render = {}; module.exports = Render; +var Common = require('../core/Common'); +var Composite = require('../body/Composite'); +var Bounds = require('../geometry/Bounds'); +var Events = require('../core/Events'); +var Grid = require('../collision/Grid'); + (function() { /**