path2d-polyfill
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -43,16 +43,17 @@ var ARG_LENGTH = { | ||
var type = command.toLowerCase(); | ||
args = parseValues(args); // overloaded moveTo | ||
var theArgs = parseValues(args); | ||
var theCommand = command; // overloaded moveTo | ||
if (type === 'm' && args.length > 2) { | ||
data.push([command].concat(args.splice(0, 2))); | ||
if (type === 'm' && theArgs.length > 2) { | ||
data.push([theCommand].concat(theArgs.splice(0, 2))); | ||
type = 'l'; | ||
command = command === 'm' ? 'l' : 'L'; | ||
theCommand = theCommand === 'm' ? 'l' : 'L'; | ||
} // Ignore invalid commands | ||
if (args.length < ARG_LENGTH[type]) { | ||
if (theArgs.length < ARG_LENGTH[type]) { | ||
return ''; | ||
} | ||
data.push([command].concat(args.splice(0, ARG_LENGTH[type]))); // The command letter can be eliminated on subsequent commands if the | ||
data.push([theCommand].concat(theArgs.splice(0, ARG_LENGTH[type]))); // The command letter can be eliminated on subsequent commands if the | ||
// same command is used multiple times in a row (e.g., you can drop the | ||
@@ -62,4 +63,4 @@ // second "L" in "M 100 200 L 200 100 L -100 -200" and use | ||
while (args.length >= ARG_LENGTH[type] && args.length && ARG_LENGTH[type]) { | ||
data.push([command].concat(args.splice(0, ARG_LENGTH[type]))); | ||
while (theArgs.length >= ARG_LENGTH[type] && theArgs.length && ARG_LENGTH[type]) { | ||
data.push([theCommand].concat(theArgs.splice(0, ARG_LENGTH[type]))); | ||
} | ||
@@ -72,2 +73,4 @@ | ||
var parsePath = parse; | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -177,3 +180,3 @@ if (!(instance instanceof Constructor)) { | ||
} else if (path) { | ||
this.segments = parse(path); | ||
this.segments = parsePath(path); | ||
} | ||
@@ -604,7 +607,17 @@ } | ||
var path2dPolyfill = polyFillPath2D; | ||
if (typeof window !== 'undefined') { | ||
polyFillPath2D(window); | ||
path2dPolyfill(window); | ||
} | ||
export { parse as parsePath, polyFillPath2D as path2dPolyfill }; | ||
var path2dPolyfill_1 = path2dPolyfill; | ||
var parsePath_1 = parsePath; | ||
var src = { | ||
path2dPolyfill: path2dPolyfill_1, | ||
parsePath: parsePath_1 | ||
}; | ||
export default src; | ||
export { parsePath_1 as parsePath, path2dPolyfill_1 as path2dPolyfill }; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).path2dPolyfill={})}(this,function(e){"use strict";var o={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=/([astvzqmhlc])([^astvzqmhlc]*)/gi,i=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function c(e){var s=[],t=String(e).trim();return"M"!==t[0]&&"m"!==t[0]||t.replace(n,function(e,t,n){var a,r=t.toLowerCase();if(n=(a=n.match(i))?a.map(Number):[],"m"===r&&2<n.length&&(s.push([t].concat(n.splice(0,2))),r="l",t="m"===t?"l":"L"),n.length<o[r])return"";for(s.push([t].concat(n.splice(0,o[r])));n.length>=o[r]&&n.length&&o[r];)s.push([t].concat(n.splice(0,o[r])));return""}),s}function l(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function u(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function L(e,t){var n=e.x*Math.cos(t)-e.y*Math.sin(t),a=e.y*Math.cos(t)+e.x*Math.sin(t);e.x=n,e.y=a}function O(e,t){e.x*=t,e.y*=t}function t(e){if(void 0!==e&&e.CanvasRenderingContext2D&&(!e.Path2D||(n=(t=e).document.createElement("canvas").getContext("2d"),a=new t.Path2D("M0 0 L1 1"),n.strokeStyle="red",n.lineWidth=1,n.stroke(a),255!==n.getImageData(0,0,1,1).data[0]))){var t,n,a,r=function(){function n(e){var t;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.segments=[],e&&e instanceof n)?(t=this.segments).push.apply(t,u(e.segments)):e&&(this.segments=c(e))}var e,t,a;return e=n,(t=[{key:"addPath",value:function(e){var t;e&&e instanceof n&&(t=this.segments).push.apply(t,u(e.segments))}},{key:"moveTo",value:function(e,t){this.segments.push(["M",e,t])}},{key:"lineTo",value:function(e,t){this.segments.push(["L",e,t])}},{key:"arc",value:function(e,t,n,a,r,s){this.segments.push(["AC",e,t,n,a,r,!!s])}},{key:"arcTo",value:function(e,t,n,a,r){this.segments.push(["AT",e,t,n,a,r])}},{key:"ellipse",value:function(e,t,n,a,r,s,o,i){this.segments.push(["E",e,t,n,a,r,s,o,!!i])}},{key:"closePath",value:function(){this.segments.push(["Z"])}},{key:"bezierCurveTo",value:function(e,t,n,a,r,s){this.segments.push(["C",e,t,n,a,r,s])}},{key:"quadraticCurveTo",value:function(e,t,n,a){this.segments.push(["Q",e,t,n,a])}},{key:"rect",value:function(e,t,n,a){this.segments.push(["R",e,t,n,a])}}])&&l(e.prototype,t),a&&l(e,a),n}(),s=e.CanvasRenderingContext2D.prototype.fill,o=e.CanvasRenderingContext2D.prototype.stroke;e.CanvasRenderingContext2D.prototype.fill=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var a="nonzero";0===t.length||1===t.length&&"string"==typeof t[0]?s.apply(this,t):(2===arguments.length&&(a=t[1]),i(this,t[0].segments),s.call(this,a))},e.CanvasRenderingContext2D.prototype.stroke=function(e){e&&i(this,e.segments),o.call(this)},e.Path2D=r}function i(e,t){var n,a,r,s,o,i,c,l,u,h,y,f,p,v,g,m,b,d,x,k,C,T,M,w,q,P,A,z,D,R={x:0,y:0},j={x:0,y:0};e.beginPath();for(var S=0;S<t.length;++S){var E=t[S];switch("S"!==(k=E[0])&&"s"!==k&&"C"!==k&&"c"!==k&&(M=T=null),"T"!==k&&"t"!==k&&"Q"!==k&&"q"!==k&&(q=w=null),k){case"m":case"M":"m"===k?(y+=E[1],p+=E[2]):(y=E[1],p=E[2]),"M"!==k&&R||(R={x:y,y:p}),e.moveTo(y,p);break;case"l":y+=E[1],p+=E[2],e.lineTo(y,p);break;case"L":y=E[1],p=E[2],e.lineTo(y,p);break;case"H":y=E[1],e.lineTo(y,p);break;case"h":y+=E[1],e.lineTo(y,p);break;case"V":p=E[1],e.lineTo(y,p);break;case"v":p+=E[1],e.lineTo(y,p);break;case"a":case"A":"a"===k?(y+=E[6],p+=E[7]):(y=E[6],p=E[7]),m=E[1],b=E[2],c=E[3]*Math.PI/180,r=!!E[4],s=!!E[5],o={x:y,y:p},L(i={x:(j.x-o.x)/2,y:(j.y-o.y)/2},-c),1<(l=i.x*i.x/(m*m)+i.y*i.y/(b*b))&&(m*=l=Math.sqrt(l),b*=l),u=m*m*b*b,h=m*m*i.y*i.y+b*b*i.x*i.x,O(C={x:m*i.y/b,y:-b*i.x/m},s!==r?Math.sqrt((u-h)/h)||0:-Math.sqrt((u-h)/h)||0),a=Math.atan2((i.y-C.y)/b,(i.x-C.x)/m),n=Math.atan2(-(i.y+C.y)/b,-(i.x+C.x)/m),L(C,c),A=C,z=(o.x+j.x)/2,D=(o.y+j.y)/2,A.x+=z,A.y+=D,e.save(),e.translate(C.x,C.y),e.rotate(c),e.scale(m,b),e.arc(0,0,1,a,n,!s),e.restore();break;case"C":T=E[3],M=E[4],y=E[5],p=E[6],e.bezierCurveTo(E[1],E[2],T,M,y,p);break;case"c":e.bezierCurveTo(E[1]+y,E[2]+p,E[3]+y,E[4]+p,E[5]+y,E[6]+p),T=E[3]+y,M=E[4]+p,y+=E[5],p+=E[6];break;case"S":null!==T&&null!==T||(T=y,M=p),e.bezierCurveTo(2*y-T,2*p-M,E[1],E[2],E[3],E[4]),T=E[1],M=E[2],y=E[3],p=E[4];break;case"s":null!==T&&null!==T||(T=y,M=p),e.bezierCurveTo(2*y-T,2*p-M,E[1]+y,E[2]+p,E[3]+y,E[4]+p),T=E[1]+y,M=E[2]+p,y+=E[3],p+=E[4];break;case"Q":w=E[1],q=E[2],y=E[3],p=E[4],e.quadraticCurveTo(w,q,y,p);break;case"q":w=E[1]+y,q=E[2]+p,y+=E[3],p+=E[4],e.quadraticCurveTo(w,q,y,p);break;case"T":null!==w&&null!==w||(w=y,q=p),w=2*y-w,q=2*p-q,y=E[1],p=E[2],e.quadraticCurveTo(w,q,y,p);break;case"t":null!==w&&null!==w||(w=y,q=p),w=2*y-w,q=2*p-q,y+=E[1],p+=E[2],e.quadraticCurveTo(w,q,y,p);break;case"z":case"Z":y=R.x,p=R.y,R=void 0,e.closePath();break;case"AC":y=E[1],p=E[2],g=E[3],a=E[4],n=E[5],P=E[6],e.arc(y,p,g,a,n,P);break;case"AT":f=E[1],v=E[2],y=E[3],p=E[4],g=E[5],e.arcTo(f,v,y,p,g);break;case"E":y=E[1],p=E[2],m=E[3],b=E[4],c=E[5],a=E[6],n=E[7],P=E[8],e.save(),e.translate(y,p),e.rotate(c),e.scale(m,b),e.arc(0,0,1,a,n,P),e.restore();break;case"R":y=E[1],p=E[2],d=E[3],x=E[4],R={x:y,y:p},e.rect(y,p,d,x)}j.x=y,j.y=p}}}"undefined"!=typeof window&&t(window),e.parsePath=c,e.path2dPolyfill=t,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).path2dPolyfill={})}(this,function(e){"use strict";var i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=/([astvzqmhlc])([^astvzqmhlc]*)/gi,c=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;var a=function(e){var o=[],t=String(e).trim();return"M"!==t[0]&&"m"!==t[0]||t.replace(n,function(e,t,n){var a=t.toLowerCase(),r=function(e){var t=e.match(c);return t?t.map(Number):[]}(n),s=t;if("m"===a&&2<r.length&&(o.push([s].concat(r.splice(0,2))),a="l",s="m"===s?"l":"L"),r.length<i[a])return"";for(o.push([s].concat(r.splice(0,i[a])));r.length>=i[a]&&r.length&&i[a];)o.push([s].concat(r.splice(0,i[a])));return""}),o};function o(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function l(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function L(e,t){var n=e.x*Math.cos(t)-e.y*Math.sin(t),a=e.y*Math.cos(t)+e.x*Math.sin(t);e.x=n,e.y=a}function O(e,t){e.x*=t,e.y*=t}var t=function(e){if(void 0!==e&&e.CanvasRenderingContext2D&&(!e.Path2D||!function(e){var t=e.document.createElement("canvas").getContext("2d"),n=new e.Path2D("M0 0 L1 1");return t.strokeStyle="red",t.lineWidth=1,t.stroke(n),255===t.getImageData(0,0,1,1).data[0]}(e))){var t=function(){function n(e){var t;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,n),this.segments=[],e&&e instanceof n?(t=this.segments).push.apply(t,l(e.segments)):e&&(this.segments=a(e))}return function(e,t,n){t&&o(e.prototype,t),n&&o(e,n)}(n,[{key:"addPath",value:function(e){var t;e&&e instanceof n&&(t=this.segments).push.apply(t,l(e.segments))}},{key:"moveTo",value:function(e,t){this.segments.push(["M",e,t])}},{key:"lineTo",value:function(e,t){this.segments.push(["L",e,t])}},{key:"arc",value:function(e,t,n,a,r,s){this.segments.push(["AC",e,t,n,a,r,!!s])}},{key:"arcTo",value:function(e,t,n,a,r){this.segments.push(["AT",e,t,n,a,r])}},{key:"ellipse",value:function(e,t,n,a,r,s,o,i){this.segments.push(["E",e,t,n,a,r,s,o,!!i])}},{key:"closePath",value:function(){this.segments.push(["Z"])}},{key:"bezierCurveTo",value:function(e,t,n,a,r,s){this.segments.push(["C",e,t,n,a,r,s])}},{key:"quadraticCurveTo",value:function(e,t,n,a){this.segments.push(["Q",e,t,n,a])}},{key:"rect",value:function(e,t,n,a){this.segments.push(["R",e,t,n,a])}}]),n}(),r=e.CanvasRenderingContext2D.prototype.fill,n=e.CanvasRenderingContext2D.prototype.stroke;e.CanvasRenderingContext2D.prototype.fill=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var a="nonzero";0===t.length||1===t.length&&"string"==typeof t[0]?r.apply(this,t):(2===arguments.length&&(a=t[1]),s(this,t[0].segments),r.call(this,a))},e.CanvasRenderingContext2D.prototype.stroke=function(e){e&&s(this,e.segments),n.call(this)},e.Path2D=t}function s(e,t){var n,a,r,s,o,i,c,l,u,h,f,y,v,p,g,m,d,b,x,k,C,T,M,P,w,q,A,z,D,R={x:0,y:0},j={x:0,y:0};e.beginPath();for(var S=0;S<t.length;++S){var E=t[S];switch("S"!==(k=E[0])&&"s"!==k&&"C"!==k&&"c"!==k&&(M=T=null),"T"!==k&&"t"!==k&&"Q"!==k&&"q"!==k&&(w=P=null),k){case"m":case"M":"m"===k?(f+=E[1],v+=E[2]):(f=E[1],v=E[2]),"M"!==k&&R||(R={x:f,y:v}),e.moveTo(f,v);break;case"l":f+=E[1],v+=E[2],e.lineTo(f,v);break;case"L":f=E[1],v=E[2],e.lineTo(f,v);break;case"H":f=E[1],e.lineTo(f,v);break;case"h":f+=E[1],e.lineTo(f,v);break;case"V":v=E[1],e.lineTo(f,v);break;case"v":v+=E[1],e.lineTo(f,v);break;case"a":case"A":"a"===k?(f+=E[6],v+=E[7]):(f=E[6],v=E[7]),m=E[1],d=E[2],c=E[3]*Math.PI/180,r=!!E[4],s=!!E[5],o={x:f,y:v},L(i={x:(j.x-o.x)/2,y:(j.y-o.y)/2},-c),1<(l=i.x*i.x/(m*m)+i.y*i.y/(d*d))&&(m*=l=Math.sqrt(l),d*=l),u=m*m*d*d,h=m*m*i.y*i.y+d*d*i.x*i.x,O(C={x:m*i.y/d,y:-d*i.x/m},s!=r?Math.sqrt((u-h)/h)||0:-Math.sqrt((u-h)/h)||0),a=Math.atan2((i.y-C.y)/d,(i.x-C.x)/m),n=Math.atan2(-(i.y+C.y)/d,-(i.x+C.x)/m),L(C,c),A=C,z=(o.x+j.x)/2,D=(o.y+j.y)/2,A.x+=z,A.y+=D,e.save(),e.translate(C.x,C.y),e.rotate(c),e.scale(m,d),e.arc(0,0,1,a,n,!s),e.restore();break;case"C":T=E[3],M=E[4],f=E[5],v=E[6],e.bezierCurveTo(E[1],E[2],T,M,f,v);break;case"c":e.bezierCurveTo(E[1]+f,E[2]+v,E[3]+f,E[4]+v,E[5]+f,E[6]+v),T=E[3]+f,M=E[4]+v,f+=E[5],v+=E[6];break;case"S":null!==T&&null!==T||(T=f,M=v),e.bezierCurveTo(2*f-T,2*v-M,E[1],E[2],E[3],E[4]),T=E[1],M=E[2],f=E[3],v=E[4];break;case"s":null!==T&&null!==T||(T=f,M=v),e.bezierCurveTo(2*f-T,2*v-M,E[1]+f,E[2]+v,E[3]+f,E[4]+v),T=E[1]+f,M=E[2]+v,f+=E[3],v+=E[4];break;case"Q":P=E[1],w=E[2],f=E[3],v=E[4],e.quadraticCurveTo(P,w,f,v);break;case"q":P=E[1]+f,w=E[2]+v,f+=E[3],v+=E[4],e.quadraticCurveTo(P,w,f,v);break;case"T":null!==P&&null!==P||(P=f,w=v),P=2*f-P,w=2*v-w,f=E[1],v=E[2],e.quadraticCurveTo(P,w,f,v);break;case"t":null!==P&&null!==P||(P=f,w=v),P=2*f-P,w=2*v-w,f+=E[1],v+=E[2],e.quadraticCurveTo(P,w,f,v);break;case"z":case"Z":f=R.x,v=R.y,R=void 0,e.closePath();break;case"AC":f=E[1],v=E[2],g=E[3],a=E[4],n=E[5],q=E[6],e.arc(f,v,g,a,n,q);break;case"AT":y=E[1],p=E[2],f=E[3],v=E[4],g=E[5],e.arcTo(y,p,f,v,g);break;case"E":f=E[1],v=E[2],m=E[3],d=E[4],c=E[5],a=E[6],n=E[7],q=E[8],e.save(),e.translate(f,v),e.rotate(c),e.scale(m,d),e.arc(0,0,1,a,n,q),e.restore();break;case"R":f=E[1],v=E[2],b=E[3],x=E[4],R={x:f,y:v},e.rect(f,v,b,x)}j.x=f,j.y=v}}};"undefined"!=typeof window&&t(window);var r=t,s=a,u={path2dPolyfill:r,parsePath:s};e.default=u,e.parsePath=s,e.path2dPolyfill=r,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "path2d-polyfill", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Polyfills Path2D api for canvas rendering", | ||
"scripts": { | ||
"build": "rm -rf dist/* && rollup -c rollup.config.js", | ||
"build:watch": "parcel src/index.js", | ||
"build": "rm -rf dist/* && rollup -c", | ||
"start": "rollup -c -w", | ||
"lint": "eslint src test", | ||
"test": "aw -c aw.config.js", | ||
"test:coverage": "aw -c aw.config.js --coverage", | ||
"example": "parcel example/index.html" | ||
"test": "nyc --reporter=html --reporter=text mocha" | ||
}, | ||
@@ -37,12 +35,14 @@ "files": [ | ||
"@babel/preset-env": "^7.4.3", | ||
"@after-work.js/aw": "^6.0.3", | ||
"babel-plugin-istanbul": "^5.1.1", | ||
"chai": "^4.2.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"parcel-bundler": "^1.12.3", | ||
"mocha": "^6.1.3", | ||
"nyc": "^13.3.0", | ||
"rollup": "^1.10.0", | ||
"rollup-plugin-babel": "^4.3.2", | ||
"rollup-plugin-uglify": "^6.0.2" | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-uglify": "^6.0.2", | ||
"rollup-plugin-live-server": "^1.0.3", | ||
"sinon": "^7.3.1", | ||
"sinon-chai": "^3.3.0" | ||
} | ||
} |
@@ -60,4 +60,4 @@ # path2d-polyfill | ||
npm install | ||
npm run example | ||
npm start | ||
``` | ||
open http://localhost:3000 to see the example page. | ||
open http://localhost:8080 to see the example page. |
@@ -1,3 +0,3 @@ | ||
import parsePath from './parse-path'; | ||
import path2dPolyfill from './path2d-polyfill'; | ||
const parsePath = require('./parse-path'); | ||
const path2dPolyfill = require('./path2d-polyfill'); | ||
@@ -8,5 +8,3 @@ if (typeof window !== 'undefined') { | ||
export { | ||
path2dPolyfill, | ||
parsePath, | ||
}; | ||
exports.path2dPolyfill = path2dPolyfill; | ||
exports.parsePath = parsePath; |
@@ -34,3 +34,3 @@ const ARG_LENGTH = { | ||
*/ | ||
export default function parse(path) { | ||
function parse(path) { | ||
const data = []; | ||
@@ -46,17 +46,17 @@ const p = String(path).trim(); | ||
let type = command.toLowerCase(); | ||
args = parseValues(args); | ||
let theArgs = parseValues(args); | ||
let theCommand = command; | ||
// overloaded moveTo | ||
if (type === 'm' && args.length > 2) { | ||
data.push([command].concat(args.splice(0, 2))); | ||
if (type === 'm' && theArgs.length > 2) { | ||
data.push([theCommand].concat(theArgs.splice(0, 2))); | ||
type = 'l'; | ||
command = command === 'm' ? 'l' : 'L'; | ||
theCommand = theCommand === 'm' ? 'l' : 'L'; | ||
} | ||
// Ignore invalid commands | ||
if (args.length < ARG_LENGTH[type]) { | ||
if (theArgs.length < ARG_LENGTH[type]) { | ||
return ''; | ||
} | ||
data.push([command].concat(args.splice(0, ARG_LENGTH[type]))); | ||
data.push([theCommand].concat(theArgs.splice(0, ARG_LENGTH[type]))); | ||
@@ -67,4 +67,4 @@ // The command letter can be eliminated on subsequent commands if the | ||
// "M 100 200 L 200 100 -100 -200" instead). | ||
while (args.length >= ARG_LENGTH[type] && args.length && ARG_LENGTH[type]) { | ||
data.push([command].concat(args.splice(0, ARG_LENGTH[type]))); | ||
while (theArgs.length >= ARG_LENGTH[type] && theArgs.length && ARG_LENGTH[type]) { | ||
data.push([theCommand].concat(theArgs.splice(0, ARG_LENGTH[type]))); | ||
} | ||
@@ -76,1 +76,3 @@ | ||
} | ||
module.exports = parse; |
@@ -1,2 +0,2 @@ | ||
import parsePath from './parse-path'; | ||
const parsePath = require('./parse-path'); | ||
@@ -243,8 +243,6 @@ /** | ||
(midPoint.y - centerPoint.y) / ry, | ||
(midPoint.x - centerPoint.x) / rx, | ||
); | ||
(midPoint.x - centerPoint.x) / rx); | ||
endAngle = Math.atan2( | ||
-(midPoint.y + centerPoint.y) / ry, | ||
-(midPoint.x + centerPoint.x) / rx, | ||
); | ||
-(midPoint.x + centerPoint.x) / rx); | ||
@@ -255,4 +253,3 @@ rotatePoint(centerPoint, angle); | ||
(endPoint.x + currentPoint.x) / 2, | ||
(endPoint.y + currentPoint.y) / 2, | ||
); | ||
(endPoint.y + currentPoint.y) / 2); | ||
@@ -280,4 +277,3 @@ canvas.save(); | ||
s[5] + x, | ||
s[6] + y, | ||
); | ||
s[6] + y); | ||
cpx = s[3] + x; // Last control point | ||
@@ -300,4 +296,3 @@ cpy = s[4] + y; | ||
s[3], | ||
s[4], | ||
); | ||
s[4]); | ||
cpx = s[1]; // last control point | ||
@@ -320,4 +315,3 @@ cpy = s[2]; | ||
s[3] + x, | ||
s[4] + y, | ||
); | ||
s[4] + y); | ||
cpx = s[1] + x; // last control point | ||
@@ -447,2 +441,2 @@ cpy = s[2] + y; | ||
export default polyFillPath2D; | ||
module.exports = polyFillPath2D; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90100
1010
13