"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_createClass=function(){function e(e,t){for(var i=0;i=0&&n<=t&&(s.beginPath(),s.moveTo(n,0),s.lineTo(n,i),s.closePath(),o>10&&s.fillText("y",n+9,20),o=0&&o<=i&&(s.beginPath(),s.moveTo(0,o),s.lineTo(t,o),s.closePath(),n>10&&s.fillText("-x",10,o+16),n0?d=Math.ceil(n/t/r)*r:n<0&&(d=Math.floor(n/t/r)*r),y=2+~~(s/t/r);y--;)v=(b=d+r*y)*t-n,f.moveTo(v,0),f.lineTo(v,a),h[y]=[c(b),v];for(d=o<0?Math.floor(o/i/l)*l:o>0?Math.ceil(o/i/l)*l:0,y=2+~~(a/i/l);y--;)p=(b=d+l*y)*i-o,f.moveTo(0,p),f.lineTo(s,p),u[y]=[c(-b),p];if(f.closePath(),f.stroke(),y=h.length,this.labels){for(f.fillStyle=this.color.labelX,m=this.labelSize/2;y--;)b=h[y][0],f.fillText(b,h[y][1]-f.measureText(b).width/2,6+m);for(f.fillStyle=this.color.labelY,y=u.length;y--;)f.fillText(u[y][0]+"",4,u[y][1])}}},{key:"_drawFunction",value:function(e,t){if("function"==typeof e){t="object"===(void 0===t?"undefined":_typeof(t))?t:{};var i=this.canvas,n=this.offsetX,o=this.offsetY,s=this.scaleX,a=this.scaleY,r="number"==typeof t.width?t.width:i.width,l="number"==typeof t.min?t.min:n/s,f="number"==typeof t.max?t.max:(r+n)/s,c=l*s-n;if(!(c>r||l>=f)){var h=i.getContext("2d"),u=-e(l)*a-o,d=void 0;for(h.strokeStyle="string"==typeof t.color?t.color:"#000000",h.lineWidth=1,h.beginPath();cf);)h.moveTo(c++,u),h.lineTo(c,u=-e(d)*a-o);h.closePath(),h.stroke()}}}},{key:"_resizeWindowEvent",value:function(e){var t=this;clearTimeout(window[t.resizeTimeoutID]),window[t.resizeTimeoutID]=setTimeout(function(){t.adjustSize().redraw()},t.redrawRate)}},{key:"_panStartEvent",value:function(e){this.panX=this.offsetX,this.panY=this.offsetY,this.canvas.parentNode.style.cursor="grabbing"}},{key:"_panMoveEvent",value:function(e){this.offsetX=this.panX-e.deltaX,this.offsetY=this.panY-e.deltaY,this.redraw(!0)}},{key:"_panEndEvent",value:function(e){this.panX=this.panY=0,this.canvas.parentNode.style.cursor=""}},{key:"drawFunctions",value:function(e){var t=this._isArray(e)&&e.length>0?e:this.functions;if(!this._isArray(t))return console.warning("invalid input object, skipping rendering phase"),this;for(var i=t.length,n=void 0,o=void 0;i--;)switch(n=t[i],o={width:this.canvas.width},void 0===n?"undefined":_typeof(n)){case"function":this._drawFunction(n,o);break;case"object":"function"==typeof n.fcn&&this._drawFunction(n.fcn,o)}return this}},{key:"setPosition",value:function(e,t){return this.offsetX="number"==typeof e?e:this.offsetX,this.offsetY="number"==typeof t?t:this.offsetY,this}},{key:"setPositionX",value:function(e){return this.offsetX="number"==typeof e?e:this.offsetX,this}},{key:"setPositionY",value:function(e){return this.offsetY="number"==typeof e?e:this.offsetY,this}},{key:"goToOrigin",value:function(){return this.offsetX=~~(-this.canvas.width/2),this.offsetY=~~(-this.canvas.height/2),this}},{key:"getScalePositionX",value:function(e){return-this.canvas.width/2+e*this.scaleX}},{key:"getScalePositionY",value:function(e){return-this.canvas.height/2+e*this.scaleY}},{key:"getCanvasX",value:function(e){return(e+this.canvas.width/2)/this.scaleX}},{key:"animate",value:function(e,t,i){(e="object"===(void 0===e?"undefined":_typeof(e))?e:{}).x="number"==typeof e.x?e.x:0,e.y="number"==typeof e.y?e.y:0,t="function"==typeof t?t:function(){};var n=this,o=n.offsetX,s=n.offsetY,a=o+e.x*n.scaleX,r=s+e.y*n.scaleY,l=a-o,f=s-r;i="number"==typeof i?i:1750;var c=function(e,t,i,n){return(e/=n/2)<1?i/2*e*e*e+t:i/2*((e-=2)*e*e+2)+t};console.log(o,a);var h=null,u=function(){};return e.x&&e.y?u=function(e){var a=e-(h=h||e);n.setPositionX(c(a,o,l,i)).setPositionY(c(a,s,f,i)).redraw(!0),a