Files
Julien Lengrand-Lambert 605bbd9695 adds failing test
2021-01-20 17:15:50 +01:00

1 line
5.4 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{58:function(t,e,o){t.exports=function(t){function e(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var o={};return e.m=t,e.c=o,e.i=function(t){return t},e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=6)}([function(t,e,o){function n(t){return l(t.duration,Date.now()-t.mouseDown)}function r(t){return t.mouseUp>0?Date.now()-t.mouseUp:0}function i(t){var e=t.duration,o=t.radius,i=.85*a(n(t),0,o,e),u=.15*a(r(t),0,o,e),l=.02*o*s(Date.now()/e);return c(0,i+u+l)}var a=o(7),u=Math.sqrt(2),s=Math.cos,c=Math.max,l=Math.min;t.exports={getMaxRadius:function(t,e,o){return l(.5*c(t,e),o)},getBlotOpacity:function(t,e){return a(r(t),e,-e,t.duration)},getBlotOuterOpacity:function(t,e){return l(this.getBlotOpacity(t,e),a(n(t),0,.3,3*t.duration))},getBlotShiftX:function(t,e,o){return l(1,i(t)/e*2/u)*(o/2-t.x)},getBlotShiftY:function(t,e,o){return l(1,i(t)/e*2/u)*(o/2-t.y)},getBlotScale:function(t){return i(t)/t.radius}}},function(t,e){t.exports={borderRadius:"inherit",height:"100%",left:0,position:"absolute",top:0,width:"100%"}},function(t,e){var o=!1;"undefined"!=typeof window&&(o="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),t.exports=o},function(t,e){t.exports=function(t){return(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)}},function(t,e,o){var n=o(0),r=function(t){var e=t.mouseUp,o=t.duration;return!e||Date.now()-e<o};t.exports=function(t){var e=[],o=!1,i=void 0,a={each:function(t,o){for(var n=0,r=e.length;n<r;n++)t.call(o,e[n])},play:function(){o||(o=!0,a.update())},stop:function(){o=!1,cancelAnimationFrame(i)},getTotalOpacity:function(t){for(var o=0,r=0,i=e.length;r<i;r++)o+=n.getBlotOuterOpacity(e[r],t);return o},update:function(){(e=e.filter(r)).length?i=requestAnimationFrame(a.update):a.stop(),t()},add:function(t){e.push(t),a.play()},release:function(t){for(var o=e.length-1;o>=0;o--)if(!e[o].mouseUp)return e[o].mouseUp=t}};return a}},function(t,e){t.exports=o(1)},function(t,e,o){function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])}return t},a=o(2),u=o(3),s=o(5),c=o(1),l=o(4),p=2*Math.PI,f=o(0),h=function(t){function e(o){n(this,e);var i=r(this,t.apply(this,arguments));return i.tick=function(){var t=i.state,e=t.ctx,o=t.color,n=t.density,r=t.height,a=t.width,u=t.store;e.save(),e.scale(n,n),e.clearRect(0,0,a,r),e.fillStyle=o,i.props.background&&(e.globalAlpha=u.getTotalOpacity(i.props.opacity),e.fillRect(0,0,a,r)),u.each(i.makeBlot,i),e.restore()},i._onPress=function(t){var e=t.button,o=t.ctrlKey,n=t.clientX,r=t.clientY,a=t.changedTouches,u=Date.now();if(a)for(var s=0;s<a.length;s++){var c=a[s],l=c.clientX,p=c.clientY;i.pushBlot(u,l,p)}else 0!==e||o||i.pushBlot(u,n,r)},i._onRelease=function(){i.state.store.release(Date.now())},i.state={color:"transparent",density:1,height:0,store:l(i.tick),touchEvents:i.touchEvents(),width:0},i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.touchEvents=function(){return this.props.hasTouch?{onTouchStart:this._onPress,onTouchEnd:this._onRelease,onTouchCancel:this._onRelease}:{onMouseDown:this._onPress,onMouseUp:this._onRelease,onMouseLeave:this._onRelease}},e.prototype.makeBlot=function(t){var e=this.state,o=e.ctx,n=e.height,r=e.width,i=t.x,a=t.y,u=t.radius;if(o.globalAlpha=f.getBlotOpacity(t,this.props.opacity),o.beginPath(),this.props.recenter){var s=Math.max(n,r);i+=f.getBlotShiftX(t,s,r),a+=f.getBlotShiftY(t,s,n)}o.arc(i,a,u*f.getBlotScale(t),0,p),o.closePath(),o.fill()},e.prototype.componentWillUnmount=function(){this.state.store.stop()},e.prototype.pushBlot=function(t,e,o){var n=this,r=this.refs.canvas;r instanceof window.HTMLCanvasElement==0&&(r=r.getDOMNode());var i=r.getBoundingClientRect(),a=i.top,s=i.bottom,c=i.left,l=i.right,p=window.getComputedStyle(r).color,h=this.state.ctx||r.getContext("2d"),d=u(h),g=s-a,w=l-c,y=f.getMaxRadius(g,w,this.props.radius);this.setState({color:p,ctx:h,density:d,height:g,width:w},(function(){n.state.store.add({duration:n.props.duration,mouseDown:t,mouseUp:0,radius:y,x:e-c,y:o-a})}))},e.prototype.render=function(){var t=this.state,e=t.density,o=t.height,n=t.width,r=t.touchEvents;return s.createElement("canvas",i({className:"ink",ref:"canvas",style:i({},c,this.props.style),height:o*e,width:n*e,onDragOver:this._onRelease},r))},e}(s.PureComponent);h.defaultProps={background:!0,duration:1e3,opacity:.25,radius:150,recenter:!0,hasTouch:a},t.exports=h},function(t,e){t.exports=function(t,e,o,n){return o*((t=t/n-1)*t*t*t*t+1)+e}}])}}]);