diff --git a/CHANGELOG.md b/CHANGELOG.md index 307324b..831d401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,30 @@ + +## 0.9.1 (2016-02-15) + + +* added default for delta parameter in Engine.update, closes #200 ([490d232](https://github.com/liabru/matter-js/commit/490d232)), closes [#200](https://github.com/liabru/matter-js/issues/200) +* added docs for body.render.opacity ([adcb610](https://github.com/liabru/matter-js/commit/adcb610)) +* added SVGPathSeg polyfill, closes #196 ([8fcb893](https://github.com/liabru/matter-js/commit/8fcb893)), closes [#196](https://github.com/liabru/matter-js/issues/196) +* Adding the opacity attribute to be able to draw semi-transarent sprites ([5b755a1](https://github.com/liabru/matter-js/commit/5b755a1)) +* allow passing of pixi objects to Matter.RenderPixi at creation, closes #193 ([dbdabcc](https://github.com/liabru/matter-js/commit/dbdabcc)), closes [#193](https://github.com/liabru/matter-js/issues/193) +* change main reference in package.json ([633c305](https://github.com/liabru/matter-js/commit/633c305)) +* Changed bounds checking MIN_VALUE to -MAX_VALUE. Fixes #202 ([dd5e260](https://github.com/liabru/matter-js/commit/dd5e260)), closes [#202](https://github.com/liabru/matter-js/issues/202) +* fix issue with Bodies.circle label option, closes #195 ([e7e8c26](https://github.com/liabru/matter-js/commit/e7e8c26)), closes [#195](https://github.com/liabru/matter-js/issues/195) +* fix lint issue ([b4e875b](https://github.com/liabru/matter-js/commit/b4e875b)) +* fixed build issue ([bb3d43f](https://github.com/liabru/matter-js/commit/bb3d43f)) +* fixed rendering of angle indicators ([aaffee3](https://github.com/liabru/matter-js/commit/aaffee3)) +* fixed rendering of compound bodies ([99dd6c5](https://github.com/liabru/matter-js/commit/99dd6c5)) +* fixes to body opacity rendering ([8ac06b2](https://github.com/liabru/matter-js/commit/8ac06b2)) +* Merge branch 'master' of https://github.com/ma1069/matter-js into ma1069-master ([c99e6af](https://github.com/liabru/matter-js/commit/c99e6af)) +* Merge pull request #199 from kevinboudot/master ([34fa27a](https://github.com/liabru/matter-js/commit/34fa27a)) +* remove redundant console.log from gulpfile ([b5006e3](https://github.com/liabru/matter-js/commit/b5006e3)) +* Update README.md ([1bfb758](https://github.com/liabru/matter-js/commit/1bfb758)) +* updated edge build ([cc80837](https://github.com/liabru/matter-js/commit/cc80837)) +* updated test refs ([cfdc0b3](https://github.com/liabru/matter-js/commit/cfdc0b3)) +* updated test refs ([4d65dd1](https://github.com/liabru/matter-js/commit/4d65dd1)) + + + # 0.9.0 (2016-01-16) diff --git a/bower.json b/bower.json index 2dda9ec..f32a049 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "Matter", - "version": "0.9.0", + "version": "0.9.1", "homepage": "https://github.com/liabru/matter-js", "authors": [ "Liam Brummitt (http://brm.io/)" diff --git a/build/matter.js b/build/matter.js index 6e22df5..fc133a9 100644 --- a/build/matter.js +++ b/build/matter.js @@ -1,5 +1,5 @@ /** -* matter-js master by @liabru 2016-02-07 +* matter-js 0.9.1 by @liabru 2016-02-15 * http://brm.io/matter-js/ * License MIT */ @@ -4442,11 +4442,12 @@ var Body = require('../body/Body'); * Triggers `collisionStart`, `collisionActive` and `collisionEnd` events. * @method update * @param {engine} engine - * @param {number} delta - * @param {number} [correction] + * @param {number} [delta=16.666] + * @param {number} [correction=1] */ Engine.update = function(engine, delta, correction) { - correction = (typeof correction !== 'undefined') ? correction : 1; + delta = delta || 1000 / 60; + correction = correction || 1; var world = engine.world, timing = engine.timing, @@ -5698,10 +5699,13 @@ var Vector = require('../geometry/Vector'); */ Bodies.circle = function(x, y, radius, options, maxSides) { options = options || {}; - options.label = 'Circle Body'; + + var circle = { + label: 'Circle Body', + circleRadius: radius + }; // approximate circles with polygons until true circles implemented in SAT - maxSides = maxSides || 25; var sides = Math.ceil(Math.max(10, Math.min(maxSides, radius))); @@ -5709,10 +5713,7 @@ var Vector = require('../geometry/Vector'); if (sides % 2 === 1) sides += 1; - // flag for better rendering - options.circleRadius = radius; - - return Bodies.polygon(x, y, sides, radius, options); + return Bodies.polygon(x, y, sides, radius, Common.extend({}, circle, options)); }; /** diff --git a/build/matter.min.js b/build/matter.min.js index 988092a..d24e658 100644 --- a/build/matter.min.js +++ b/build/matter.min.js @@ -1,5 +1,5 @@ /** -* matter-js master by @liabru 2016-02-07 +* matter-js 0.9.1 by @liabru 2016-02-15 * http://brm.io/matter-js/ * License MIT */ @@ -35,7 +35,7 @@ s.constraintImpulse.x+=y.x,s.constraintImpulse.y+=y.y,s.constraintImpulse.angle- 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>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;o0&&d.trigger(n,"collisionStart",{pairs:S.collisionStart}),s.preSolvePosition(S.list),c=0;c0&&d.trigger(n,"collisionActive",{pairs:S.collisionActive}),S.collisionEnd.length>0&&d.trigger(n,"collisionEnd",{pairs:S.collisionEnd}),e(x),v.isModified&&u.setModified(v,!1,!1,!0),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;ie.deltaMax?e.deltaMax:n,a=n/e.delta,e.delta=n),0!==e.timeScalePrev&&(a*=s.timeScale/e.timeScalePrev),0===s.timeScale&&(a=0),e.timeScalePrev=s.timeScale,e.correction=a,e.frameCounter+=1,o-e.counterTimestamp>=1e3&&(e.fps=e.frameCounter*((o-e.counterTimestamp)/1e3),e.counterTimestamp=o, e.frameCounter=0),i.trigger(e,"tick",l),i.trigger(t,"tick",l),t.world.isModified&&t.render&&t.render.controller&&t.render.controller.clear&&t.render.controller.clear(t.render),i.trigger(e,"beforeUpdate",l),r.update(t,n,a),i.trigger(e,"afterUpdate",l),t.render&&t.render.controller&&(i.trigger(e,"beforeRender",l),i.trigger(t,"beforeRender",l),t.render.controller.world(t),i.trigger(e,"afterRender",l),i.trigger(t,"afterRender",l)),i.trigger(e,"afterTick",l),i.trigger(t,"afterTick",l)},n.stop=function(e){t(e.frameRequestId)},n.start=function(e,t){n.run(e,t)}}()},{"./Common":14,"./Engine":15,"./Events":16}],20:[function(e,t,o){var n={};t.exports=n;var i=e("./Events");!function(){n._motionWakeThreshold=.18,n._motionSleepThreshold=.08,n._minBias=.9,n.update=function(e,t){for(var o=t*t*t,i=0;i0&&r.motion=r.sleepThreshold&&n.set(r,!0)):r.sleepCounter>0&&(r.sleepCounter-=1)}else n.set(r,!1)}},n.afterCollisions=function(e,t){for(var o=t*t*t,i=0;in._motionWakeThreshold*o&&n.set(c,!1)}}}},n.set=function(e,t){var o=e.isSleeping;t?(e.isSleeping=!0,e.sleepCounter=e.sleepThreshold,e.positionImpulse.x=0,e.positionImpulse.y=0,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.anglePrev=e.angle,e.speed=0,e.angularSpeed=0,e.motion=0,o||i.trigger(e,"sleepStart")):(e.isSleeping=!1,e.sleepCounter=0,o&&i.trigger(e,"sleepEnd"))}}()},{"./Events":16}],21:[function(e,t,o){var n={};t.exports=n;var i=e("../geometry/Vertices"),r=e("../core/Common"),s=e("../body/Body"),a=e("../geometry/Bounds"),l=e("../geometry/Vector");!function(){n.rectangle=function(e,t,o,n,a){ -a=a||{};var l={label:"Rectangle Body",position:{x:e,y:t},vertices:i.fromPath("L 0 0 L "+o+" 0 L "+o+" "+n+" L 0 "+n)};if(a.chamfer){var c=a.chamfer;l.vertices=i.chamfer(l.vertices,c.radius,c.quality,c.qualityMin,c.qualityMax),delete a.chamfer}return s.create(r.extend({},l,a))},n.trapezoid=function(e,t,o,n,a,l){l=l||{},a*=.5;var c,d=(1-2*a)*o,u=o*a,p=u+d,v=p+u;c=.5>a?"L 0 0 L "+u+" "+-n+" L "+p+" "+-n+" L "+v+" 0":"L 0 0 L "+p+" "+-n+" L "+v+" 0";var f={label:"Trapezoid Body",position:{x:e,y:t},vertices:i.fromPath(c)};if(l.chamfer){var y=l.chamfer;f.vertices=i.chamfer(f.vertices,y.radius,y.quality,y.qualityMin,y.qualityMax),delete l.chamfer}return s.create(r.extend({},f,l))},n.circle=function(e,t,o,i,r){i=i||{},i.label="Circle Body",r=r||25;var s=Math.ceil(Math.max(10,Math.min(r,o)));return s%2===1&&(s+=1),i.circleRadius=o,n.polygon(e,t,s,o,i)},n.polygon=function(e,t,o,a,l){if(l=l||{},3>o)return n.circle(e,t,a,l);for(var c=2*Math.PI/o,d="",u=.5*c,p=0;o>p;p+=1){var v=u+p*c,f=Math.cos(v)*a,y=Math.sin(v)*a; +a=a||{};var l={label:"Rectangle Body",position:{x:e,y:t},vertices:i.fromPath("L 0 0 L "+o+" 0 L "+o+" "+n+" L 0 "+n)};if(a.chamfer){var c=a.chamfer;l.vertices=i.chamfer(l.vertices,c.radius,c.quality,c.qualityMin,c.qualityMax),delete a.chamfer}return s.create(r.extend({},l,a))},n.trapezoid=function(e,t,o,n,a,l){l=l||{},a*=.5;var c,d=(1-2*a)*o,u=o*a,p=u+d,v=p+u;c=.5>a?"L 0 0 L "+u+" "+-n+" L "+p+" "+-n+" L "+v+" 0":"L 0 0 L "+p+" "+-n+" L "+v+" 0";var f={label:"Trapezoid Body",position:{x:e,y:t},vertices:i.fromPath(c)};if(l.chamfer){var y=l.chamfer;f.vertices=i.chamfer(f.vertices,y.radius,y.quality,y.qualityMin,y.qualityMax),delete l.chamfer}return s.create(r.extend({},f,l))},n.circle=function(e,t,o,i,s){i=i||{};var a={label:"Circle Body",circleRadius:o};s=s||25;var l=Math.ceil(Math.max(10,Math.min(s,o)));return l%2===1&&(l+=1),n.polygon(e,t,l,o,r.extend({},a,i))},n.polygon=function(e,t,o,a,l){if(l=l||{},3>o)return n.circle(e,t,a,l);for(var c=2*Math.PI/o,d="",u=.5*c,p=0;o>p;p+=1){var v=u+p*c,f=Math.cos(v)*a,y=Math.sin(v)*a; d+="L "+f.toFixed(3)+" "+y.toFixed(3)+" "}var m={label:"Polygon Body",position:{x:e,y:t},vertices:i.fromPath(d)};if(l.chamfer){var g=l.chamfer;m.vertices=i.chamfer(m.vertices,g.radius,g.quality,g.qualityMin,g.qualityMax),delete l.chamfer}return s.create(r.extend({},m,l))},n.fromVertices=function(e,t,o,n,c,d,u){var p,v,f,y,m,g,x,h,b;for(n=n||{},v=[],c="undefined"!=typeof c?c:!1,d="undefined"!=typeof d?d:.01,u="undefined"!=typeof u?u:10,window.decomp||r.log("Bodies.fromVertices: poly-decomp.js required. Could not decompose vertices. Fallback to convex hull.","warn"),r.isArray(o[0])||(o=[o]),h=0;h0&&i.area(A)T&&B>V&&(k[x].isInternal=!0,I[b].isInternal=!0)}}}}}return v.length>1?(p=s.create(r.extend({parts:v.slice(0)},n)),s.setPosition(p,{x:e,y:t}),p):v[0]}}()},{"../body/Body":1,"../core/Common":14,"../geometry/Bounds":24,"../geometry/Vector":26,"../geometry/Vertices":27}],22:[function(e,t,o){var n={};t.exports=n;var i=e("../body/Composite"),r=e("../constraint/Constraint"),s=e("../core/Common"),a=e("../body/Body"),l=e("./Bodies");!function(){n.stack=function(e,t,o,n,r,s,l){for(var c,d=i.create({label:"Stack"}),u=e,p=t,v=0,f=0;n>f;f++){for(var y=0,m=0;o>m;m++){ var g=l(u,p,m,f,c,v);if(g){var x=g.bounds.max.y-g.bounds.min.y,h=g.bounds.max.x-g.bounds.min.x;x>y&&(y=x),a.translate(g,{x:.5*h,y:.5*x}),u=g.bounds.max.x+r,i.addBody(d,g),c=g,v+=1}else u+=r}p+=y+s,u=e}return d},n.chain=function(e,t,o,n,a,l){for(var c=e.bodies,d=1;dl;l++){for(c=1;t>c;c++)d=v[c-1+l*t],u=v[c+l*t],i.addConstraint(e,r.create(s.extend({bodyA:d,bodyB:u},a)));if(l>0)for(c=0;t>c;c++)d=v[c+(l-1)*t],u=v[c+l*t],i.addConstraint(e,r.create(s.extend({bodyA:d,bodyB:u},a))),n&&c>0&&(p=v[c-1+(l-1)*t],i.addConstraint(e,r.create(s.extend({bodyA:p,bodyB:u},a)))),n&&t-1>c&&(p=v[c+1+(l-1)*t],i.addConstraint(e,r.create(s.extend({bodyA:p,bodyB:u diff --git a/package.json b/package.json index a281203..48ab7ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matter-js", - "version": "0.9.0", + "version": "0.9.1", "license": "MIT", "homepage": "http://brm.io/matter-js/", "author": "Liam Brummitt (http://brm.io/)",