mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-30 10:20:52 -05:00
release 0.9.3
This commit is contained in:
parent
e13d2d2645
commit
326816fcf7
5 changed files with 30 additions and 8 deletions
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -1,3 +1,20 @@
|
|||
<a name="0.9.3"></a>
|
||||
## 0.9.3 (2016-04-19)
|
||||
|
||||
|
||||
* added readonly to docs for type property, closes #235 ([afd7531](https://github.com/liabru/matter-js/commit/afd7531)), closes [#235](https://github.com/liabru/matter-js/issues/235)
|
||||
* Engine uses provided world; fixes issue #230 ([158c404](https://github.com/liabru/matter-js/commit/158c404)), closes [#230](https://github.com/liabru/matter-js/issues/230)
|
||||
* fix issue with removed bodies causing collisions ([23a773a](https://github.com/liabru/matter-js/commit/23a773a))
|
||||
* fix Matter.Engine.create docs to show element param is optional ([e2e7c0b](https://github.com/liabru/matter-js/commit/e2e7c0b))
|
||||
* handle missing options in Engine.create ([f36fe2c](https://github.com/liabru/matter-js/commit/f36fe2c))
|
||||
* improved release tasks ([e13d2d2](https://github.com/liabru/matter-js/commit/e13d2d2))
|
||||
* Merge branch 'master' of github.com:liabru/matter-js ([d373172](https://github.com/liabru/matter-js/commit/d373172))
|
||||
* Merge pull request #237 from iamjoshua/master ([b724959](https://github.com/liabru/matter-js/commit/b724959)), closes [#230](https://github.com/liabru/matter-js/issues/230)
|
||||
* set release task to default to patch ([9d396fe](https://github.com/liabru/matter-js/commit/9d396fe))
|
||||
* updated edge build ([7eb9ac7](https://github.com/liabru/matter-js/commit/7eb9ac7))
|
||||
|
||||
|
||||
|
||||
<a name="0.9.2"></a>
|
||||
## 0.9.2 (2016-04-07)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Matter",
|
||||
"version": "0.9.2",
|
||||
"version": "0.9.3",
|
||||
"homepage": "https://github.com/liabru/matter-js",
|
||||
"authors": [
|
||||
"Liam Brummitt <liam@brm.io> (http://brm.io/)"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* matter-js master by @liabru 2016-04-09
|
||||
* matter-js 0.9.3 by @liabru 2016-04-19
|
||||
* http://brm.io/matter-js/
|
||||
* License MIT
|
||||
*/
|
||||
|
@ -704,6 +704,7 @@ var Axes = require('../geometry/Axes');
|
|||
* @property type
|
||||
* @type string
|
||||
* @default "body"
|
||||
* @readOnly
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -1755,6 +1756,7 @@ var Body = require('./Body');
|
|||
* @property type
|
||||
* @type string
|
||||
* @default "composite"
|
||||
* @readOnly
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -3711,6 +3713,7 @@ var Common = require('../core/Common');
|
|||
* @property type
|
||||
* @type string
|
||||
* @default "constraint"
|
||||
* @readOnly
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -4029,6 +4032,7 @@ var Bounds = require('../geometry/Bounds');
|
|||
* @property type
|
||||
* @type string
|
||||
* @default "constraint"
|
||||
* @readOnly
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -4425,16 +4429,17 @@ var Body = require('../body/Body');
|
|||
* All properties have default values, and many are pre-calculated automatically based on other properties.
|
||||
* See the properties section below for detailed information on what you can pass via the `options` object.
|
||||
* @method create
|
||||
* @param {HTMLElement} element
|
||||
* @param {HTMLElement} [element]
|
||||
* @param {object} [options]
|
||||
* @return {engine} engine
|
||||
*/
|
||||
Engine.create = function(element, options) {
|
||||
|
||||
// options may be passed as the first (and only) argument
|
||||
options = Common.isElement(element) ? options : element;
|
||||
element = Common.isElement(element) ? element : null;
|
||||
|
||||
options = options || {};
|
||||
|
||||
var defaults = {
|
||||
positionIterations: 6,
|
||||
velocityIterations: 4,
|
||||
|
@ -4465,7 +4470,7 @@ var Body = require('../body/Body');
|
|||
engine.render = engine.render.controller.create(engine.render);
|
||||
}
|
||||
|
||||
engine.world = World.create(engine.world);
|
||||
engine.world = options.world || World.create(engine.world);
|
||||
engine.pairs = Pairs.create();
|
||||
engine.broadphase = engine.broadphase.controller.create(engine.broadphase);
|
||||
engine.metrics = engine.metrics || { extended: false };
|
||||
|
|
4
build/matter.min.js
vendored
4
build/matter.min.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* matter-js master by @liabru 2016-04-09
|
||||
* matter-js 0.9.3 by @liabru 2016-04-19
|
||||
* http://brm.io/matter-js/
|
||||
* License MIT
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ i.position.x-=y.x,i.position.y-=y.y,i.angle+=P),s&&!s.isStatic&&(P=r.cross(h,M)*
|
|||
n.pointA=o.position,n.bodyB=e.body=s,n.pointB={x:o.position.x-s.position.x,y:o.position.y-s.position.y},n.angleB=s.angle,r.set(s,!1),a.trigger(e,"startdrag",{mouse:o,body:s});break}}}else n.bodyB=e.body=null,n.pointB=null,s&&a.trigger(e,"enddrag",{mouse:o,body:s})};var e=function(e){var t=e.mouse,o=t.sourceEvents;o.mousemove&&a.trigger(e,"mousemove",{mouse:t}),o.mousedown&&a.trigger(e,"mousedown",{mouse:t}),o.mouseup&&a.trigger(e,"mouseup",{mouse:t}),s.clearSourceEvents(t)}}()},{"../body/Composite":2,"../collision/Detector":5,"../core/Common":14,"../core/Events":16,"../core/Mouse":18,"../core/Sleeping":20,"../geometry/Bounds":24,"../geometry/Vertices":27,"./Constraint":12}],14:[function(e,t,o){var n={};t.exports=n,function(){n._nextId=0,n._seed=0,n.extend=function(e,t){var o,i,r;"boolean"==typeof t?(o=2,r=t):(o=1,r=!0),i=Array.prototype.slice.call(arguments,o);for(var s=0;s<i.length;s++){var a=i[s];if(a)for(var l in a)r&&a[l]&&a[l].constructor===Object?e[l]&&e[l].constructor!==Object?e[l]=a[l]:(e[l]=e[l]||{},
|
||||
n.extend(e[l],r,a[l])):e[l]=a[l]}return e},n.clone=function(e,t){return n.extend({},t,e)},n.keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var o in e)t.push(o);return t},n.values=function(e){var t=[];if(Object.keys){for(var o=Object.keys(e),n=0;n<o.length;n++)t.push(e[o[n]]);return t}for(var i in e)t.push(e[i]);return t},n.shadeColor=function(e,t){var o=parseInt(e.slice(1),16),n=Math.round(2.55*t),i=(o>>16)+n,r=(o>>8&255)+n,s=(255&o)+n;return"#"+(16777216+65536*(255>i?1>i?0:i:255)+256*(255>r?1>r?0:r:255)+(255>s?1>s?0:s:255)).toString(16).slice(1)},n.shuffle=function(e){for(var t=e.length-1;t>0;t--){var o=Math.floor(n.random()*(t+1)),i=e[t];e[t]=e[o],e[o]=i}return e},n.choose=function(e){return e[Math.floor(n.random()*e.length)]},n.isElement=function(e){try{return e instanceof HTMLElement}catch(t){return"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument}},n.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e);
|
||||
},n.clamp=function(e,t,o){return t>e?t:e>o?o:e},n.sign=function(e){return 0>e?-1:1},n.now=function(){var e=window.performance||{};return e.now=function(){return e.now||e.webkitNow||e.msNow||e.oNow||e.mozNow||function(){return+new Date}}(),e.now()},n.random=function(t,o){return t="undefined"!=typeof t?t:0,o="undefined"!=typeof o?o:1,t+e()*(o-t)},n.colorToNumber=function(e){return e=e.replace("#",""),3==e.length&&(e=e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)),parseInt(e,16)},n.log=function(e,t){if(console&&console.log&&console.warn)switch(t){case"warn":console.warn("Matter.js:",e);break;case"error":console.log("Matter.js:",e)}},n.nextId=function(){return n._nextId++},n.indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var o=0;o<e.length;o++)if(e[o]===t)return o;return-1};var e=function(){return n._seed=(9301*n._seed+49297)%233280,n._seed/233280}}()},{}],15:[function(e,t,o){var n={};t.exports=n;var i=e("../body/World"),r=e("./Sleeping"),s=e("../collision/Resolver"),a=e("../render/Render"),l=e("../collision/Pairs"),c=(e("./Metrics"),
|
||||
e("../collision/Grid")),d=e("./Events"),u=e("../body/Composite"),p=e("../constraint/Constraint"),v=e("./Common"),f=e("../body/Body");!function(){n.create=function(e,t){t=v.isElement(e)?t:e,e=v.isElement(e)?e:null;var o={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],timing:{timestamp:0,timeScale:1},broadphase:{controller:c}},n=v.extend(o,t);if(e||n.render){var r={element:e,controller:a};n.render=v.extend(r,n.render)}return n.render&&n.render.controller&&(n.render=n.render.controller.create(n.render)),n.world=i.create(n.world),n.pairs=l.create(),n.broadphase=n.broadphase.controller.create(n.broadphase),n.metrics=n.metrics||{extended:!1},n},n.update=function(n,i,a){i=i||1e3/60,a=a||1;var c,v=n.world,f=n.timing,y=n.broadphase,m=[];f.timestamp+=i*f.timeScale;var g={timestamp:f.timestamp};d.trigger(n,"beforeUpdate",g);var x=u.allBodies(v),h=u.allConstraints(v);for(n.enableSleeping&&r.update(x,f.timeScale),t(x,v.gravity),o(x,i,f.timeScale,a,v.bounds),
|
||||
e("../collision/Grid")),d=e("./Events"),u=e("../body/Composite"),p=e("../constraint/Constraint"),v=e("./Common"),f=e("../body/Body");!function(){n.create=function(e,t){t=v.isElement(e)?t:e,e=v.isElement(e)?e:null,t=t||{};var o={positionIterations:6,velocityIterations:4,constraintIterations:2,enableSleeping:!1,events:[],timing:{timestamp:0,timeScale:1},broadphase:{controller:c}},n=v.extend(o,t);if(e||n.render){var r={element:e,controller:a};n.render=v.extend(r,n.render)}return n.render&&n.render.controller&&(n.render=n.render.controller.create(n.render)),n.world=t.world||i.create(n.world),n.pairs=l.create(),n.broadphase=n.broadphase.controller.create(n.broadphase),n.metrics=n.metrics||{extended:!1},n},n.update=function(n,i,a){i=i||1e3/60,a=a||1;var c,v=n.world,f=n.timing,y=n.broadphase,m=[];f.timestamp+=i*f.timeScale;var g={timestamp:f.timestamp};d.trigger(n,"beforeUpdate",g);var x=u.allBodies(v),h=u.allConstraints(v);for(n.enableSleeping&&r.update(x,f.timeScale),t(x,v.gravity),o(x,i,f.timeScale,a,v.bounds),
|
||||
c=0;c<n.constraintIterations;c++)p.solveAll(h,f.timeScale);p.postSolveAll(x),y.controller?(v.isModified&&y.controller.clear(y),y.controller.update(y,x,n,v.isModified),m=y.pairsList):m=x,v.isModified&&u.setModified(v,!1,!1,!0);var b=y.detector(m,n),S=n.pairs,C=f.timestamp;for(l.update(S,b,C),l.removeOld(S,C),n.enableSleeping&&r.afterCollisions(S.list,f.timeScale),S.collisionStart.length>0&&d.trigger(n,"collisionStart",{pairs:S.collisionStart}),s.preSolvePosition(S.list),c=0;c<n.positionIterations;c++)s.solvePosition(S.list,f.timeScale);for(s.postSolvePosition(x),s.preSolveVelocity(S.list),c=0;c<n.velocityIterations;c++)s.solveVelocity(S.list,f.timeScale);return S.collisionActive.length>0&&d.trigger(n,"collisionActive",{pairs:S.collisionActive}),S.collisionEnd.length>0&&d.trigger(n,"collisionEnd",{pairs:S.collisionEnd}),e(x),d.trigger(n,"afterUpdate",g),n},n.merge=function(e,t){if(v.extend(e,t),t.world){e.world=t.world,n.clear(e);for(var o=u.allBodies(e.world),i=0;i<o.length;i++){var s=o[i];
|
||||
r.set(s,!1),s.id=v.nextId()}}},n.clear=function(e){var t=e.world;l.clear(e.pairs);var o=e.broadphase;if(o.controller){var n=u.allBodies(t);o.controller.clear(o),o.controller.update(o,n,e,!0)}};var e=function(e){for(var t=0;t<e.length;t++){var o=e[t];o.force.x=0,o.force.y=0,o.torque=0}},t=function(e,t){var o="undefined"!=typeof t.scale?t.scale:.001;if((0!==t.x||0!==t.y)&&0!==o)for(var n=0;n<e.length;n++){var i=e[n];i.isStatic||i.isSleeping||(i.force.y+=i.mass*t.y*o,i.force.x+=i.mass*t.x*o)}},o=function(e,t,o,n,i){for(var r=0;r<e.length;r++){var s=e[r];s.isStatic||s.isSleeping||f.update(s,t,o,n)}}}()},{"../body/Body":1,"../body/Composite":2,"../body/World":3,"../collision/Grid":6,"../collision/Pairs":8,"../collision/Resolver":10,"../constraint/Constraint":12,"../render/Render":29,"./Common":14,"./Events":16,"./Metrics":17,"./Sleeping":20}],16:[function(e,t,o){var n={};t.exports=n;var i=e("./Common");!function(){n.on=function(e,t,o){for(var n,i=t.split(" "),r=0;r<i.length;r++)n=i[r],e.events=e.events||{},
|
||||
e.events[n]=e.events[n]||[],e.events[n].push(o);return o},n.off=function(e,t,o){if(!t)return void(e.events={});"function"==typeof t&&(o=t,t=i.keys(e.events).join(" "));for(var n=t.split(" "),r=0;r<n.length;r++){var s=e.events[n[r]],a=[];if(o&&s)for(var l=0;l<s.length;l++)s[l]!==o&&a.push(s[l]);e.events[n[r]]=a}},n.trigger=function(e,t,o){var n,r,s,a;if(e.events){o||(o={}),n=t.split(" ");for(var l=0;l<n.length;l++)if(r=n[l],s=e.events[r]){a=i.clone(o,!1),a.name=r,a.source=e;for(var c=0;c<s.length;c++)s[c].apply(e,[a])}}}}()},{"./Common":14}],17:[function(e,t,o){},{"../body/Composite":2,"./Common":14}],18:[function(e,t,o){var n={};t.exports=n;var i=e("../core/Common");!function(){n.create=function(t){var o={};return t||i.log("Mouse.create: element was undefined, defaulting to document.body","warn"),o.element=t||document.body,o.absolute={x:0,y:0},o.position={x:0,y:0},o.mousedownPosition={x:0,y:0},o.mouseupPosition={x:0,y:0},o.offset={x:0,y:0},o.scale={x:1,y:1},o.wheelDelta=0,o.button=-1,o.pixelRatio=o.element.getAttribute("data-pixel-ratio")||1,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "matter-js",
|
||||
"version": "0.9.2",
|
||||
"version": "0.9.3",
|
||||
"license": "MIT",
|
||||
"homepage": "http://brm.io/matter-js/",
|
||||
"author": "Liam Brummitt <liam@brm.io> (http://brm.io/)",
|
||||
|
|
Loading…
Reference in a new issue