@visactor/vrender-kits 0.11.0-alpha.1 → 0.11.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2588 -1
- package/dist/index.min.js +1 -1
- package/package.json +3 -7
package/dist/index.js
CHANGED
|
@@ -1 +1,2588 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("reflect-metadata"),require("@visactor/vrender"),require("inversify")):"function"==typeof define&&define.amd?define(["exports","reflect-metadata","@visactor/vrender","inversify"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).VRender=e.VRender||{},e.VRender.Kits={}),null,e.vrender,e.inversify)}(this,(function(e,t,a,r){"use strict";function n(e){return n="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},n(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(n=r.key,i=void 0,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var r=a.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(n,"string"))?i:String(i)),r)}var n,i}function o(e,t,a){return t&&s(e.prototype,t),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function f(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,r=h(e);if(t){var n=h(this).constructor;a=Reflect.construct(r,arguments,n)}else a=r.apply(this,arguments);return f(this,a)}}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var r,n,i,s,o=[],l=!0,h=!1;try{if(i=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;l=!1}else for(;!(l=(r=i.call(a)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(e){h=!0,n=e}finally{try{if(!l&&null!=a.return&&(s=a.return(),Object(s)!==s))return}finally{if(h)throw n}}return o}}(e,t)||v(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){if(e){if("string"==typeof e)return g(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,r=new Array(t);a<t;a++)r[a]=e[a];return r}function y(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=v(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var r=0,n=function(){};return{s:n,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,o=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return s=e.done,e},e:function(e){o=!0,i=e},f:function(){try{s||null==a.return||a.return()}finally{if(o)throw i}}}}function m(e,t,a,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,a):r;if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,a,r);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(o=(s<3?i(o):s>3?i(t,a,o):i(t,a))||o);return s>3&&o&&Object.defineProperty(t,a,o),o}function b(e,t){return function(a,r){t(a,r,e)}}function k(e,t){if("object"===("undefined"==typeof Reflect?"undefined":n(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function M(e,t,a){if(e&&e.length){var r=p(t,2),n=r[0],i=r[1],s=Math.PI/180*a,o=Math.cos(s),l=Math.sin(s);e.forEach((function(e){var t=p(e,2),a=t[0],r=t[1];e[0]=(a-n)*o-(r-i)*l+n,e[1]=(a-n)*l+(r-i)*o+i}))}}function S(e){var t=e[0],a=e[1];return Math.sqrt(Math.pow(t[0]-a[0],2)+Math.pow(t[1]-a[1],2))}function x(e,t){var a=t.hachureAngle+90,r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.max(r,.1);var n=[0,0];if(a){var i,s=y(e);try{for(s.s();!(i=s.n()).done;){M(i.value,n,a)}}catch(e){s.e(e)}finally{s.f()}}var o=function(e,t){var a,r=[],n=y(e);try{for(n.s();!(a=n.n()).done;){var i=d(a.value);i[0].join(",")!==i[i.length-1].join(",")&&i.push([i[0][0],i[0][1]]),i.length>2&&r.push(i)}}catch(e){n.e(e)}finally{n.f()}var s=[];t=Math.max(t,.1);for(var o=[],l=0,h=r;l<h.length;l++)for(var u=h[l],f=0;f<u.length-1;f++){var c=u[f],p=u[f+1];if(c[1]!==p[1]){var v=Math.min(c[1],p[1]);o.push({ymin:v,ymax:Math.max(c[1],p[1]),x:v===c[1]?c[0]:p[0],islope:(p[0]-c[0])/(p[1]-c[1])})}}if(o.sort((function(e,t){return e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax)})),!o.length)return s;for(var g=[],m=o[0].ymin;g.length||o.length;){if(o.length){for(var b=-1,k=0;k<o.length&&!(o[k].ymin>m);k++)b=k;o.splice(0,b+1).forEach((function(e){g.push({s:m,edge:e})}))}if(g=g.filter((function(e){return!(e.edge.ymax<=m)})),g.sort((function(e,t){return e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x)})),g.length>1)for(var M=0;M<g.length;M+=2){var S=M+1;if(S>=g.length)break;var x=g[M].edge,O=g[S].edge;s.push([[Math.round(x.x),m],[Math.round(O.x),m]])}m+=t,g.forEach((function(e){e.edge.x=e.edge.x+t*e.edge.islope}))}return s}(e,r);if(a){var l,h=y(e);try{for(h.s();!(l=h.n()).done;){M(l.value,n,-a)}}catch(e){h.e(e)}finally{h.f()}!function(e,t,a){var r=[];e.forEach((function(e){return r.push.apply(r,d(e))})),M(r,t,a)}(o,n,-a)}return o}var O=function(){function e(t){i(this,e),this.helper=t}return o(e,[{key:"fillPolygons",value:function(e,t){return this._fillPolygons(e,t)}},{key:"_fillPolygons",value:function(e,t){var a=x(e,t);return{type:"fillSketch",ops:this.renderLines(a,t)}}},{key:"renderLines",value:function(e,t){var a,r=[],n=y(e);try{for(n.s();!(a=n.n()).done;){var i=a.value;r.push.apply(r,d(this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],t)))}}catch(e){n.e(e)}finally{n.f()}return r}}]),e}(),w=function(e){l(a,e);var t=c(a);function a(){return i(this,a),t.apply(this,arguments)}return o(a,[{key:"fillPolygons",value:function(e,t){var a=t.hachureGap;a<0&&(a=4*t.strokeWidth),a=Math.max(a,.1);var r,n=x(e,Object.assign({},t,{hachureGap:a})),i=Math.PI/180*t.hachureAngle,s=[],o=.5*a*Math.cos(i),l=.5*a*Math.sin(i),h=y(n);try{for(h.s();!(r=h.n()).done;){var u=p(r.value,2),f=u[0],c=u[1];S([f,c])&&s.push([[f[0]-o,f[1]+l],d(c)],[[f[0]+o,f[1]-l],d(c)])}}catch(e){h.e(e)}finally{h.f()}return{type:"fillSketch",ops:this.renderLines(s,t)}}}]),a}(O),P=function(e){l(a,e);var t=c(a);function a(){return i(this,a),t.apply(this,arguments)}return o(a,[{key:"fillPolygons",value:function(e,t){var a=this._fillPolygons(e,t),r=Object.assign({},t,{hachureAngle:t.hachureAngle+90}),n=this._fillPolygons(e,r);return a.ops=a.ops.concat(n.ops),a}}]),a}(O),D=function(){function e(t){i(this,e),this.helper=t}return o(e,[{key:"fillPolygons",value:function(e,t){var a=x(e,t=Object.assign({},t,{hachureAngle:0}));return this.dotsOnLines(a,t)}},{key:"dotsOnLines",value:function(e,t){var a=[],r=t.hachureGap;r<0&&(r=4*t.strokeWidth),r=Math.max(r,.1);var n=t.fillWeight;n<0&&(n=t.strokeWidth/2);var i,s=r/4,o=y(e);try{for(o.s();!(i=o.n()).done;)for(var l=i.value,h=S(l),u=h/r,f=Math.ceil(u)-1,c=h-f*r,p=(l[0][0]+l[1][0])/2-r/4,v=Math.min(l[0][1],l[1][1]),g=0;g<f;g++){var m=v+c+g*r,b=p-s+2*Math.random()*s,k=m-s+2*Math.random()*s,M=this.helper.ellipse(b,k,n,n,t);a.push.apply(a,d(M.ops))}}catch(e){o.e(e)}finally{o.f()}return{type:"fillSketch",ops:a}}}]),e}(),R=function(){function e(t){i(this,e),this.helper=t}return o(e,[{key:"fillPolygons",value:function(e,t){var a=x(e,t);return{type:"fillSketch",ops:this.dashedLine(a,t)}}},{key:"dashedLine",value:function(e,t){var a=this,r=t.dashOffset<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashOffset,n=t.dashGap<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashGap,i=[];return e.forEach((function(e){var s=S(e),o=Math.floor(s/(r+n)),l=(s+n-o*(r+n))/2,h=e[0],u=e[1];h[0]>u[0]&&(h=e[1],u=e[0]);for(var f=Math.atan((u[1]-h[1])/(u[0]-h[0])),c=0;c<o;c++){var p=c*(r+n),v=p+r,g=[h[0]+p*Math.cos(f)+l*Math.cos(f),h[1]+p*Math.sin(f)+l*Math.sin(f)],y=[h[0]+v*Math.cos(f)+l*Math.cos(f),h[1]+v*Math.sin(f)+l*Math.sin(f)];i.push.apply(i,d(a.helper.doubleLineOps(g[0],g[1],y[0],y[1],t)))}})),i}}]),e}(),T=function(){function e(t){i(this,e),this.helper=t}return o(e,[{key:"fillPolygons",value:function(e,t){var a=t.hachureGap<0?4*t.strokeWidth:t.hachureGap,r=t.zigzagOffset<0?a:t.zigzagOffset,n=x(e,t=Object.assign({},t,{hachureGap:a+r}));return{type:"fillSketch",ops:this.zigzagLines(n,r,t)}}},{key:"zigzagLines",value:function(e,t,a){var r=this,n=[];return e.forEach((function(e){var i=S(e),s=Math.round(i/(2*t)),o=e[0],l=e[1];o[0]>l[0]&&(o=e[1],l=e[0]);for(var h=Math.atan((l[1]-o[1])/(l[0]-o[0])),u=0;u<s;u++){var f=2*u*t,c=2*(u+1)*t,p=Math.sqrt(2*Math.pow(t,2)),v=[o[0]+f*Math.cos(h),o[1]+f*Math.sin(h)],g=[o[0]+c*Math.cos(h),o[1]+c*Math.sin(h)],y=[v[0]+p*Math.cos(h+Math.PI/4),v[1]+p*Math.sin(h+Math.PI/4)];n.push.apply(n,d(r.helper.doubleLineOps(v[0],v[1],y[0],y[1],a)).concat(d(r.helper.doubleLineOps(y[0],y[1],g[0],g[1],a))))}})),n}}]),e}(),C={},L=function(){function e(t){i(this,e),this.seed=t}return o(e,[{key:"next",value:function(){return this.seed?(Math.pow(2,31)-1&(this.seed=Math.imul(48271,this.seed)))/Math.pow(2,31):Math.random()}}]),e}(),z={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function W(e,t){return e.type===t}function G(e){for(var t=[],a=function(e){for(var t=new Array;""!==e;)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:0,text:RegExp.$1},e=e.substr(RegExp.$1.length);else{if(!e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];t[t.length]={type:1,text:"".concat(parseFloat(RegExp.$1))},e=e.substr(RegExp.$1.length)}return t[t.length]={type:2,text:""},t}(e),r="BOD",n=0,i=a[n];!W(i,2);){var s=0,o=[];if("BOD"===r){if("M"!==i.text&&"m"!==i.text)return G("M0,0"+e);n++,s=z[i.text],r=i.text}else W(i,1)?s=z[r]:(n++,s=z[i.text],r=i.text);if(!(n+s<a.length))throw new Error("Path data ended short");for(var l=n;l<n+s;l++){var h=a[l];if(!W(h,1))throw new Error("Param not a number: "+r+","+h.text);o[o.length]=+h.text}if("number"!=typeof z[r])throw new Error("Bad segment: "+r);var u={key:r,data:o};t.push(u),i=a[n+=s],"M"===r&&(r="L"),"m"===r&&(r="l")}return t}function F(e){var t,a,r,n,i=0,s=0,o=0,l=0,h=[],u=y(e);try{for(u.s();!(n=u.n()).done;){var f=n.value,c=f.key,v=f.data;switch(c){case"M":h.push({key:"M",data:d(v)}),t=p(v,2),i=t[0],s=t[1],o=(a=p(v,2))[0],l=a[1];break;case"m":i+=v[0],s+=v[1],h.push({key:"M",data:[i,s]}),o=i,l=s;break;case"L":h.push({key:"L",data:d(v)}),r=p(v,2),i=r[0],s=r[1];break;case"l":i+=v[0],s+=v[1],h.push({key:"L",data:[i,s]});break;case"C":h.push({key:"C",data:d(v)}),i=v[4],s=v[5];break;case"c":var g=v.map((function(e,t){return t%2?e+s:e+i}));h.push({key:"C",data:g}),i=g[4],s=g[5];break;case"Q":h.push({key:"Q",data:d(v)}),i=v[2],s=v[3];break;case"q":var m=v.map((function(e,t){return t%2?e+s:e+i}));h.push({key:"Q",data:m}),i=m[2],s=m[3];break;case"A":h.push({key:"A",data:d(v)}),i=v[5],s=v[6];break;case"a":i+=v[5],s+=v[6],h.push({key:"A",data:[v[0],v[1],v[2],v[3],v[4],i,s]});break;case"H":h.push({key:"H",data:d(v)}),i=v[0];break;case"h":i+=v[0],h.push({key:"H",data:[i]});break;case"V":h.push({key:"V",data:d(v)}),s=v[0];break;case"v":s+=v[0],h.push({key:"V",data:[s]});break;case"S":h.push({key:"S",data:d(v)}),i=v[2],s=v[3];break;case"s":var b=v.map((function(e,t){return t%2?e+s:e+i}));h.push({key:"S",data:b}),i=b[2],s=b[3];break;case"T":h.push({key:"T",data:d(v)}),i=v[0],s=v[1];break;case"t":i+=v[0],s+=v[1],h.push({key:"T",data:[i,s]});break;case"Z":case"z":h.push({key:"Z",data:[]}),i=o,s=l}}}catch(e){u.e(e)}finally{u.f()}return h}function A(e){var t,a,r,n,i=[],s="",o=0,l=0,h=0,u=0,f=0,c=0,v=y(e);try{for(v.s();!(n=v.n()).done;){var g=n.value,m=g.key,b=g.data;switch(m){case"M":i.push({key:"M",data:d(b)}),o=(t=p(b,2))[0],l=t[1],h=(a=p(b,2))[0],u=a[1];break;case"C":i.push({key:"C",data:d(b)}),o=b[4],l=b[5],f=b[2],c=b[3];break;case"L":i.push({key:"L",data:d(b)}),o=(r=p(b,2))[0],l=r[1];break;case"H":o=b[0],i.push({key:"L",data:[o,l]});break;case"V":l=b[0],i.push({key:"L",data:[o,l]});break;case"S":var k=0,M=0;"C"===s||"S"===s?(k=o+(o-f),M=l+(l-c)):(k=o,M=l),i.push({key:"C",data:[k,M].concat(d(b))}),f=b[0],c=b[1],o=b[2],l=b[3];break;case"T":var S=p(b,2),x=S[0],O=S[1],w=0,P=0;"Q"===s||"T"===s?(w=o+(o-f),P=l+(l-c)):(w=o,P=l);var D=o+2*(w-o)/3,R=l+2*(P-l)/3,T=x+2*(w-x)/3,C=O+2*(P-O)/3;i.push({key:"C",data:[D,R,T,C,x,O]}),f=w,c=P,o=x,l=O;break;case"Q":var L=p(b,4),z=L[0],W=L[1],G=L[2],F=L[3],A=o+2*(z-o)/3,j=l+2*(W-l)/3,I=G+2*(z-G)/3,E=F+2*(W-F)/3;i.push({key:"C",data:[A,j,I,E,G,F]}),f=z,c=W,o=G,l=F;break;case"A":var V=Math.abs(b[0]),q=Math.abs(b[1]),B=b[2],Y=b[3],Z=b[4],H=b[5],Q=b[6];0===V||0===q?(i.push({key:"C",data:[o,l,H,Q,H,Q]}),o=H,l=Q):o===H&&l===Q||(_(o,l,H,Q,V,q,B,Y,Z).forEach((function(e){i.push({key:"C",data:e})})),o=H,l=Q);break;case"Z":i.push({key:"Z",data:[]}),o=h,l=u}s=m}}catch(e){v.e(e)}finally{v.f()}return i}function j(e,t,a){return[e*Math.cos(a)-t*Math.sin(a),e*Math.sin(a)+t*Math.cos(a)]}function _(e,t,a,r,n,i,s,o,l,h){var u,f=(u=s,Math.PI*u/180),c=[],d=0,v=0,g=0,y=0;if(h){var m=p(h,4);d=m[0],v=m[1],g=m[2],y=m[3]}else{var b,k;e=(b=p(j(e,t,-f),2))[0],t=b[1];var M=(e-(a=(k=p(j(a,r,-f),2))[0]))/2,S=(t-(r=k[1]))/2,x=M*M/(n*n)+S*S/(i*i);x>1&&(n*=x=Math.sqrt(x),i*=x);var O=n*n,w=i*i,P=O*w-O*S*S-w*M*M,D=O*S*S+w*M*M,R=(o===l?-1:1)*Math.sqrt(Math.abs(P/D));g=R*n*S/i+(e+a)/2,y=R*-i*M/n+(t+r)/2,d=Math.asin(parseFloat(((t-y)/i).toFixed(9))),v=Math.asin(parseFloat(((r-y)/i).toFixed(9))),e<g&&(d=Math.PI-d),a<g&&(v=Math.PI-v),d<0&&(d=2*Math.PI+d),v<0&&(v=2*Math.PI+v),l&&d>v&&(d-=2*Math.PI),!l&&v>d&&(v-=2*Math.PI)}var T=v-d;if(Math.abs(T)>120*Math.PI/180){var C=v,L=a,z=r;v=l&&v>d?d+120*Math.PI/180*1:d+120*Math.PI/180*-1,c=_(a=g+n*Math.cos(v),r=y+i*Math.sin(v),L,z,n,i,s,0,l,[v,C,g,y])}T=v-d;var W=Math.cos(d),G=Math.sin(d),F=Math.cos(v),A=Math.sin(v),I=Math.tan(T/4),E=4/3*n*I,V=4/3*i*I,q=[e,t],B=[e+E*G,t-V*W],Y=[a+E*A,r-V*F],Z=[a,r];if(B[0]=2*q[0]-B[0],B[1]=2*q[1]-B[1],h)return[B,Y,Z].concat(c);c=[B,Y,Z].concat(c);for(var H=[],Q=0;Q<c.length;Q+=3){var N=j(c[Q][0],c[Q][1],f),U=j(c[Q+1][0],c[Q+1][1],f),$=j(c[Q+2][0],c[Q+2][1],f);H.push([N[0],N[1],U[0],U[1],$[0],$[1]])}return H}var I={randOffset:function(e,t){return U(e,t)},randOffsetWithRange:function(e,t,a){return N(e,t,a)},ellipse:function(e,t,a,r,n){return B(e,t,n,q(a,r,n)).opset},doubleLineOps:function(e,t,a,r,n){return $(e,t,a,r,n,!0)}};function E(e,t,a,r,n){return{type:"path",ops:$(e,t,a,r,n)}}function V(e,t,a){var r=(e||[]).length;if(r>2){for(var n=[],i=0;i<r-1;i++)n.push.apply(n,d($(e[i][0],e[i][1],e[i+1][0],e[i+1][1],a)));return t&&n.push.apply(n,d($(e[r-1][0],e[r-1][1],e[0][0],e[0][1],a))),{type:"path",ops:n}}return 2===r?E(e[0][0],e[0][1],e[1][0],e[1][1],a):{type:"path",ops:[]}}function q(e,t,a){var r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(e/2,2)+Math.pow(t/2,2))/2)),n=Math.ceil(Math.max(a.curveStepCount,a.curveStepCount/Math.sqrt(200)*r)),i=2*Math.PI/n,s=Math.abs(e/2),o=Math.abs(t/2),l=1-a.curveFitting;return{increment:i,rx:s+=U(s*l,a),ry:o+=U(o*l,a)}}function B(e,t,a,r){var n=p(ee(r.increment,e,t,r.rx,r.ry,1,r.increment*N(.1,N(.4,1,a),a),a),2),i=n[0],s=n[1],o=J(i,null,a);if(!a.disableMultiStroke&&0!==a.roughness){var l=J(p(ee(r.increment,e,t,r.rx,r.ry,1.5,0,a),1)[0],null,a);o=o.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:o}}}function Y(e,t,a,r,n,i,s,o,l){var h=e,u=t,f=Math.abs(a/2),c=Math.abs(r/2);f+=U(.01*f,l),c+=U(.01*c,l);for(var p=n,v=i;p<0;)p+=2*Math.PI,v+=2*Math.PI;v-p>2*Math.PI&&(p=0,v=2*Math.PI);var g=2*Math.PI/l.curveStepCount,y=Math.min(g/2,(v-p)/2),m=te(y,h,u,f,c,p,v,1,l);if(!l.disableMultiStroke){var b=te(y,h,u,f,c,p,v,1.5,l);m.push.apply(m,d(b))}return s&&(o?m.push.apply(m,d($(h,u,h+f*Math.cos(p),u+c*Math.sin(p),l)).concat(d($(h,u,h+f*Math.cos(v),u+c*Math.sin(v),l)))):m.push({op:"lineTo",data:[h,u]},{op:"lineTo",data:[h+f*Math.cos(p),u+c*Math.sin(p)]})),{type:"path",ops:m}}function Z(e,t){var a,r=[],n=y(e);try{for(n.s();!(a=n.n()).done;){var i=a.value;if(i.length){var s=t.maxRandomnessOffset||0,o=i.length;if(o>2){r.push({op:"move",data:[i[0][0]+U(s,t),i[0][1]+U(s,t)]});for(var l=1;l<o;l++)r.push({op:"lineTo",data:[i[l][0]+U(s,t),i[l][1]+U(s,t)]})}}}}catch(e){n.e(e)}finally{n.f()}return{type:"fillPath",ops:r}}function H(e,t){return function(e,t){var a=e.fillStyle||"hachure";if(!C[a])switch(a){case"zigzag":C[a]||(C[a]=new w(t));break;case"cross-hatch":C[a]||(C[a]=new P(t));break;case"dots":C[a]||(C[a]=new D(t));break;case"dashed":C[a]||(C[a]=new R(t));break;case"zigzag-line":C[a]||(C[a]=new T(t));break;default:C[a="hachure"]||(C[a]=new O(t))}return C[a]}(t,I).fillPolygons(e,t)}function Q(e){return e.randomizer||(e.randomizer=new L(e.seed||0)),e.randomizer.next()}function N(e,t,a){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a.roughness*r*(Q(a)*(t-e)+e)}function U(e,t){return N(-e,e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1)}function $(e,t,a,r,n){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?n.disableMultiStrokeFill:n.disableMultiStroke,s=X(e,t,a,r,n,!0,!1);if(i)return s;var o=X(e,t,a,r,n,!0,!0);return s.concat(o)}function X(e,t,a,r,n,i,s){var o,l=Math.pow(e-a,2)+Math.pow(t-r,2),h=Math.sqrt(l);o=h<200?1:h>500?.4:-.0016668*h+1.233334;var u=n.maxRandomnessOffset||0;u*u*100>l&&(u=h/10);var f=u/2,c=.2+.2*Q(n),p=n.bowing*n.maxRandomnessOffset*(r-t)/200,d=n.bowing*n.maxRandomnessOffset*(e-a)/200;p=U(p,n,o),d=U(d,n,o);var v=[],g=function(){return U(f,n,o)},y=function(){return U(u,n,o)},m=n.preserveVertices;return i&&(s?v.push({op:"move",data:[e+(m?0:g()),t+(m?0:g())]}):v.push({op:"move",data:[e+(m?0:U(u,n,o)),t+(m?0:U(u,n,o))]})),s?v.push({op:"bcurveTo",data:[p+e+(a-e)*c+g(),d+t+(r-t)*c+g(),p+e+2*(a-e)*c+g(),d+t+2*(r-t)*c+g(),a+(m?0:g()),r+(m?0:g())]}):v.push({op:"bcurveTo",data:[p+e+(a-e)*c+y(),d+t+(r-t)*c+y(),p+e+2*(a-e)*c+y(),d+t+2*(r-t)*c+y(),a+(m?0:y()),r+(m?0:y())]}),v}function K(e,t,a){var r=[];r.push([e[0][0]+U(t,a),e[0][1]+U(t,a)]),r.push([e[0][0]+U(t,a),e[0][1]+U(t,a)]);for(var n=1;n<e.length;n++)r.push([e[n][0]+U(t,a),e[n][1]+U(t,a)]),n===e.length-1&&r.push([e[n][0]+U(t,a),e[n][1]+U(t,a)]);return J(r,null,a)}function J(e,t,a){var r=e.length,n=[];if(r>3){var i=[],s=1-a.curveTightness;n.push({op:"move",data:[e[1][0],e[1][1]]});for(var o=1;o+2<r;o++){var l=e[o];i[0]=[l[0],l[1]],i[1]=[l[0]+(s*e[o+1][0]-s*e[o-1][0])/6,l[1]+(s*e[o+1][1]-s*e[o-1][1])/6],i[2]=[e[o+1][0]+(s*e[o][0]-s*e[o+2][0])/6,e[o+1][1]+(s*e[o][1]-s*e[o+2][1])/6],i[3]=[e[o+1][0],e[o+1][1]],n.push({op:"bcurveTo",data:[i[1][0],i[1][1],i[2][0],i[2][1],i[3][0],i[3][1]]})}if(t&&2===t.length){var h=a.maxRandomnessOffset;n.push({op:"lineTo",data:[t[0]+U(h,a),t[1]+U(h,a)]})}}else 3===r?(n.push({op:"move",data:[e[1][0],e[1][1]]}),n.push({op:"bcurveTo",data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):2===r&&n.push.apply(n,d($(e[0][0],e[0][1],e[1][0],e[1][1],a)));return n}function ee(e,t,a,r,n,i,s,o){var l=[],h=[];if(0===o.roughness){e/=4,h.push([t+r*Math.cos(-e),a+n*Math.sin(-e)]);for(var u=0;u<=2*Math.PI;u+=e){var f=[t+r*Math.cos(u),a+n*Math.sin(u)];l.push(f),h.push(f)}h.push([t+r*Math.cos(0),a+n*Math.sin(0)]),h.push([t+r*Math.cos(e),a+n*Math.sin(e)])}else{var c=U(.5,o)-Math.PI/2;h.push([U(i,o)+t+.9*r*Math.cos(c-e),U(i,o)+a+.9*n*Math.sin(c-e)]);for(var p=2*Math.PI+c-.01,d=c;d<p;d+=e){var v=[U(i,o)+t+r*Math.cos(d),U(i,o)+a+n*Math.sin(d)];l.push(v),h.push(v)}h.push([U(i,o)+t+r*Math.cos(c+2*Math.PI+.5*s),U(i,o)+a+n*Math.sin(c+2*Math.PI+.5*s)]),h.push([U(i,o)+t+.98*r*Math.cos(c+s),U(i,o)+a+.98*n*Math.sin(c+s)]),h.push([U(i,o)+t+.9*r*Math.cos(c+.5*s),U(i,o)+a+.9*n*Math.sin(c+.5*s)])}return[h,l]}function te(e,t,a,r,n,i,s,o,l){var h=i+U(.1,l),u=[];u.push([U(o,l)+t+.9*r*Math.cos(h-e),U(o,l)+a+.9*n*Math.sin(h-e)]);for(var f=h;f<=s;f+=e)u.push([U(o,l)+t+r*Math.cos(f),U(o,l)+a+n*Math.sin(f)]);return u.push([t+r*Math.cos(s),a+n*Math.sin(s)]),u.push([t+r*Math.cos(s),a+n*Math.sin(s)]),J(u,null,l)}function ae(e){return d(e)}function re(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function ne(e,t,a){var r=re(t,a);if(0===r)return re(e,t);var n=((e[0]-t[0])*(a[0]-t[0])+(e[1]-t[1])*(a[1]-t[1]))/r;return re(e,ie(t,a,n=Math.max(0,Math.min(1,n))))}function ie(e,t,a){return[e[0]+(t[0]-e[0])*a,e[1]+(t[1]-e[1])*a]}function se(e,t,a,r){var n,i,s=r||[];if(function(e,t){var a=e[t+0],r=e[t+1],n=e[t+2],i=e[t+3],s=3*r[0]-2*a[0]-i[0];s*=s;var o=3*r[1]-2*a[1]-i[1];o*=o;var l=3*n[0]-2*i[0]-a[0];l*=l;var h=3*n[1]-2*i[1]-a[1];return s<l&&(s=l),o<(h*=h)&&(o=h),s+o}(e,t)<a){var o=e[t+0];s.length?(n=s[s.length-1],i=o,Math.sqrt(re(n,i))>1&&s.push(o)):s.push(o),s.push(e[t+3])}else{var l=.5,h=e[t+0],u=e[t+1],f=e[t+2],c=e[t+3],p=ie(h,u,l),d=ie(u,f,l),v=ie(f,c,l),g=ie(p,d,l),y=ie(d,v,l),m=ie(g,y,l);se([h,p,g,m],0,a,s),se([m,y,v,c],0,a,s)}return s}function oe(e,t){return le(e,0,e.length,t)}function le(e,t,a,r,n){for(var i=n||[],s=e[t],o=e[a-1],l=0,h=1,u=t+1;u<a-1;++u){var f=ne(e[u],s,o);f>l&&(l=f,h=u)}return Math.sqrt(l)>r?(le(e,t,h+1,r,i),le(e,h,a,r,i)):(i.length||i.push(s),i.push(o)),i}function he(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.15,a=arguments.length>2?arguments[2]:void 0,r=[],n=(e.length-1)/3,i=0;i<n;i++)se(e,3*i,t,r);return a&&a>0?le(r,0,r.length,a):r}var ue="none",fe=function(){function e(t){i(this,e),this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}return o(e,[{key:"_o",value:function(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}},{key:"_d",value:function(e,t,a){return{shape:e,sets:t||[],options:a||this.defaultOptions}}},{key:"line",value:function(e,t,a,r,n){var i=this._o(n);return this._d("line",[E(e,t,a,r,i)],i)}},{key:"rectangle",value:function(e,t,a,r,n){var i=this._o(n),s=[],o=function(e,t,a,r,n){return function(e,t){return V(e,!0,t)}([[e,t],[e+a,t],[e+a,t+r],[e,t+r]],n)}(e,t,a,r,i);if(i.fill){var l=[[e,t],[e+a,t],[e+a,t+r],[e,t+r]];"solid"===i.fillStyle?s.push(Z([l],i)):s.push(H([l],i))}return i.stroke!==ue&&s.push(o),this._d("rectangle",s,i)}},{key:"ellipse",value:function(e,t,a,r,n){var i=this._o(n),s=[],o=q(a,r,i),l=B(e,t,i,o);if(i.fill)if("solid"===i.fillStyle){var h=B(e,t,i,o).opset;h.type="fillPath",s.push(h)}else s.push(H([l.estimatedPoints],i));return i.stroke!==ue&&s.push(l.opset),this._d("ellipse",s,i)}},{key:"circle",value:function(e,t,a,r){var n=this.ellipse(e,t,a,a,r);return n.shape="circle",n}},{key:"linearPath",value:function(e,t){var a=this._o(t);return this._d("linearPath",[V(e,!1,a)],a)}},{key:"arc",value:function(e,t,a,r,n,i){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0,l=this._o(o),h=[],u=Y(e,t,a,r,n,i,s,!0,l);if(s&&l.fill)if("solid"===l.fillStyle){var f=Object.assign({},l);f.disableMultiStroke=!0;var c=Y(e,t,a,r,n,i,!0,!1,f);c.type="fillPath",h.push(c)}else h.push(function(e,t,a,r,n,i,s){var o=e,l=t,h=Math.abs(a/2),u=Math.abs(r/2);h+=U(.01*h,s),u+=U(.01*u,s);for(var f=n,c=i;f<0;)f+=2*Math.PI,c+=2*Math.PI;c-f>2*Math.PI&&(f=0,c=2*Math.PI);for(var p=(c-f)/s.curveStepCount,d=[],v=f;v<=c;v+=p)d.push([o+h*Math.cos(v),l+u*Math.sin(v)]);return d.push([o+h*Math.cos(c),l+u*Math.sin(c)]),d.push([o,l]),H([d],s)}(e,t,a,r,n,i,l));return l.stroke!==ue&&h.push(u),this._d("arc",h,l)}},{key:"curve",value:function(e,t){var a=this._o(t),r=[],n=function(e,t){var a=K(e,1*(1+.2*t.roughness),t);if(!t.disableMultiStroke){var r=K(e,1.5*(1+.22*t.roughness),function(e){var t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}(t));a=a.concat(r)}return{type:"path",ops:a}}(e,a);if(a.fill&&a.fill!==ue&&e.length>=3){var i=he(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=e.length;if(a<3)throw new Error("A curve must have at least three points.");var r=[];if(3===a)r.push(ae(e[0]),ae(e[1]),ae(e[2]),ae(e[2]));else{var n=[];n.push(e[0],e[0]);for(var i=1;i<e.length;i++)n.push(e[i]),i===e.length-1&&n.push(e[i]);var s=[],o=1-t;r.push(ae(n[0]));for(var l=1;l+2<n.length;l++){var h=n[l];s[0]=[h[0],h[1]],s[1]=[h[0]+(o*n[l+1][0]-o*n[l-1][0])/6,h[1]+(o*n[l+1][1]-o*n[l-1][1])/6],s[2]=[n[l+1][0]+(o*n[l][0]-o*n[l+2][0])/6,n[l+1][1]+(o*n[l][1]-o*n[l+2][1])/6],s[3]=[n[l+1][0],n[l+1][1]],r.push(s[1],s[2],s[3])}}return r}(e),10,(1+a.roughness)/2);"solid"===a.fillStyle?r.push(Z([i],a)):r.push(H([i],a))}return a.stroke!==ue&&r.push(n),this._d("curve",r,a)}},{key:"polygon",value:function(e,t){var a=this._o(t),r=[],n=V(e,!0,a);return a.fill&&("solid"===a.fillStyle?r.push(Z([e],a)):r.push(H([e],a))),a.stroke!==ue&&r.push(n),this._d("polygon",r,a)}},{key:"path",value:function(e,t){var a=this._o(t),r=[];if(!e)return this._d("path",r,a);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");var n=a.fill&&"transparent"!==a.fill&&a.fill!==ue,i=a.stroke!==ue,s=!!(a.simplification&&a.simplification<1),o=function(e,t,a){var r,n=A(F(G(e))),i=[],s=[],o=[0,0],l=[],h=function(){var e;l.length>=4&&(e=s).push.apply(e,d(he(l,1))),l=[]},u=function(){h(),s.length&&(i.push(s),s=[])},f=y(n);try{for(f.s();!(r=f.n()).done;){var c=r.value,p=c.key,v=c.data;switch(p){case"M":u(),o=[v[0],v[1]],s.push(o);break;case"L":h(),s.push([v[0],v[1]]);break;case"C":if(!l.length){var g=s.length?s[s.length-1]:o;l.push([g[0],g[1]])}l.push([v[0],v[1]]),l.push([v[2],v[3]]),l.push([v[4],v[5]]);break;case"Z":h(),s.push([o[0],o[1]])}}}catch(e){f.e(e)}finally{f.f()}if(u(),!a)return i;for(var m=[],b=0,k=i;b<k.length;b++){var M=oe(k[b],a);M.length&&m.push(M)}return m}(e,0,s?4-4*a.simplification:(1+a.roughness)/2);return n&&("solid"===a.fillStyle?r.push(Z(o,a)):r.push(H(o,a))),i&&(s?o.forEach((function(e){r.push(V(e,!1,a))})):r.push(function(e,t){var a,r=A(F(G(e))),n=[],i=[0,0],s=[0,0],o=y(r);try{var l=function(){var e=a.value,r=e.key,o=e.data;switch(r){case"M":var l=1*(t.maxRandomnessOffset||0),h=t.preserveVertices;n.push({op:"move",data:o.map((function(e){return e+(h?0:U(l,t))}))}),s=[o[0],o[1]],i=[o[0],o[1]];break;case"L":n.push.apply(n,d($(s[0],s[1],o[0],o[1],t))),s=[o[0],o[1]];break;case"C":var u=p(o,6),f=u[0],c=u[1],v=u[2],g=u[3],y=u[4],m=u[5];n.push.apply(n,d(function(e,t,a,r,n,i,s,o){for(var l=[],h=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3],u=[0,0],f=o.disableMultiStroke?1:2,c=o.preserveVertices,p=0;p<f;p++)0===p?l.push({op:"move",data:[s[0],s[1]]}):l.push({op:"move",data:[s[0]+(c?0:U(h[0],o)),s[1]+(c?0:U(h[0],o))]}),u=c?[n,i]:[n+U(h[p],o),i+U(h[p],o)],l.push({op:"bcurveTo",data:[e+U(h[p],o),t+U(h[p],o),a+U(h[p],o),r+U(h[p],o),u[0],u[1]]});return l}(f,c,v,g,y,m,s,t))),s=[y,m];break;case"Z":n.push.apply(n,d($(s[0],s[1],i[0],i[1],t))),s=[i[0],i[1]]}};for(o.s();!(a=o.n()).done;)l()}catch(e){o.e(e)}finally{o.f()}return{type:"path",ops:n}}(e,a))),this._d("path",r,a)}},{key:"opsToPath",value:function(e,t){var a,r="",n=y(e.ops);try{for(n.s();!(a=n.n()).done;){var i=a.value,s="number"==typeof t&&t>=0?i.data.map((function(e){return+e.toFixed(t)})):i.data;switch(i.op){case"move":r+="M".concat(s[0]," ").concat(s[1]," ");break;case"bcurveTo":r+="C".concat(s[0]," ").concat(s[1],", ").concat(s[2]," ").concat(s[3],", ").concat(s[4]," ").concat(s[5]," ");break;case"lineTo":r+="L".concat(s[0]," ").concat(s[1]," ")}}}catch(e){n.e(e)}finally{n.f()}return r.trim()}},{key:"toPaths",value:function(e){var t,a=e.sets||[],r=e.options||this.defaultOptions,n=[],i=y(a);try{for(i.s();!(t=i.n()).done;){var s=t.value,o=null;switch(s.type){case"path":o={d:this.opsToPath(s),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:ue};break;case"fillPath":o={d:this.opsToPath(s),stroke:ue,strokeWidth:0,fill:r.fill||ue};break;case"fillSketch":o=this.fillSketch(s,r)}o&&n.push(o)}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"fillSketch",value:function(e,t){var a=t.fillWeight;return a<0&&(a=t.strokeWidth/2),{d:this.opsToPath(e),stroke:t.fill||ue,strokeWidth:a,fill:ue}}}],[{key:"newSeed",value:function(){return Math.floor(Math.random()*Math.pow(2,31))}}]),e}(),ce=function(){function e(t,a){i(this,e),this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new fe(a)}return o(e,[{key:"draw",value:function(e){var t,a=e.sets||[],r=e.options||this.getDefaultOptions(),n=this.ctx,i=e.options.fixedDecimalPlaceDigits,s=y(a);try{for(s.s();!(t=s.n()).done;){var o=t.value;switch(o.type){case"path":n.save(),n.strokeStyle="none"===r.stroke?"transparent":r.stroke,n.lineWidth=r.strokeWidth,r.strokeLineDash&&n.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(n.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(n,o,i),n.restore();break;case"fillPath":n.save(),n.fillStyle=r.fill||"";var l="curve"===e.shape||"polygon"===e.shape||"path"===e.shape?"evenodd":"nonzero";this._drawToContext(n,o,i,l),n.restore();break;case"fillSketch":this.fillSketch(n,o,r)}}}catch(e){s.e(e)}finally{s.f()}}},{key:"fillSketch",value:function(e,t,a){var r=a.fillWeight;r<0&&(r=a.strokeWidth/2),e.save(),a.fillLineDash&&e.setLineDash(a.fillLineDash),a.fillLineDashOffset&&(e.lineDashOffset=a.fillLineDashOffset),e.strokeStyle=a.fill||"",e.lineWidth=r,this._drawToContext(e,t,a.fixedDecimalPlaceDigits),e.restore()}},{key:"_drawToContext",value:function(e,t,a){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"nonzero";e.beginPath();var n,i=y(t.ops);try{for(i.s();!(n=i.n()).done;){var s=n.value,o="number"==typeof a&&a>=0?s.data.map((function(e){return+e.toFixed(a)})):s.data;switch(s.op){case"move":e.moveTo(o[0],o[1]);break;case"bcurveTo":e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5]);break;case"lineTo":e.lineTo(o[0],o[1])}}}catch(e){i.e(e)}finally{i.f()}"fillPath"===t.type?e.fill(r):e.stroke()}},{key:"generator",get:function(){return this.gen}},{key:"getDefaultOptions",value:function(){return this.gen.defaultOptions}},{key:"line",value:function(e,t,a,r,n){var i=this.gen.line(e,t,a,r,n);return this.draw(i),i}},{key:"rectangle",value:function(e,t,a,r,n){var i=this.gen.rectangle(e,t,a,r,n);return this.draw(i),i}},{key:"ellipse",value:function(e,t,a,r,n){var i=this.gen.ellipse(e,t,a,r,n);return this.draw(i),i}},{key:"circle",value:function(e,t,a,r){var n=this.gen.circle(e,t,a,r);return this.draw(n),n}},{key:"linearPath",value:function(e,t){var a=this.gen.linearPath(e,t);return this.draw(a),a}},{key:"polygon",value:function(e,t){var a=this.gen.polygon(e,t);return this.draw(a),a}},{key:"arc",value:function(e,t,a,r,n,i){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7?arguments[7]:void 0,l=this.gen.arc(e,t,a,r,n,i,s,o);return this.draw(l),l}},{key:"curve",value:function(e,t){var a=this.gen.curve(e,t);return this.draw(a),a}},{key:"path",value:function(e,t){var a=this.gen.path(e,t);return this.draw(a),a}}]),e}(),pe=function(e,t){return new ce(e,t)};const de={maxRandomnessOffset:3,roughness:1,bowing:1,curveFitting:.95,curveTightness:void 0,curveStepCount:9,fillStyle:"hachure",fillWeight:void 0,hachureAngle:60,hachureGap:6,simplification:0,dashOffset:void 0,dashGap:void 0,zigzagOffset:void 0,seed:1,fillLineDash:void 0,fillLineDashOffset:void 0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!0,fixedDecimalPlaceDigits:void 0};let ve=class{canvasRenderer;type;numberType;style="rough";constructor(e){this.canvasRenderer=e,this.type="arc",this.numberType=a.ARC_NUMBER_TYPE}draw(e,t,r,n){const{context:i}=r;if(!i)return;const s=i.canvas.nativeCanvas,o=pe(s);i.highPerformanceSave();const l=a.getTheme(e).arc;let{x:h=l.x,y:u=l.y}=e.attribute;if(e.transMatrix.onlyTranslate()){const{dx:t=l.dx,dy:a=l.dy}=e.attribute;h+=t,u+=a,i.setTransformForCurrent()}else h=0,u=0,i.transformFromMatrix(e.transMatrix,!0);const f=new a.CustomPath2D,{fill:c=l.fill,stroke:p=l.stroke,lineWidth:d=l.lineWidth,outerRadius:v=l.outerRadius,innerRadius:g=l.innerRadius,maxRandomnessOffset:y=de.maxRandomnessOffset,roughness:m=de.roughness,bowing:b=de.bowing,curveFitting:k=de.curveFitting,curveTightness:M=de.curveTightness,curveStepCount:S=de.curveStepCount,fillStyle:x=de.fillStyle,fillWeight:O=de.fillWeight,hachureAngle:w=de.hachureAngle,hachureGap:P=de.hachureGap,simplification:D=de.simplification,dashOffset:R=de.dashOffset,dashGap:T=de.dashGap,zigzagOffset:C=de.zigzagOffset,seed:L=de.seed,fillLineDash:z=de.fillLineDash,fillLineDashOffset:W=de.fillLineDashOffset,disableMultiStroke:G=de.disableMultiStroke,disableMultiStrokeFill:F=de.disableMultiStrokeFill,preserveVertices:A=de.preserveVertices,fixedDecimalPlaceDigits:j=de.fixedDecimalPlaceDigits}=e.attribute;a.drawArcPath(e,f,h,u,v,g),o.path(f.toString(),{fill:c||void 0,stroke:p||void 0,strokeWidth:d,maxRandomnessOffset:y,roughness:m,bowing:b,curveFitting:k,curveTightness:M,curveStepCount:S,fillStyle:x,fillWeight:O,hachureAngle:w,hachureGap:P,simplification:D,dashOffset:R,dashGap:T,zigzagOffset:C,seed:L,fillLineDash:z,fillLineDashOffset:W,disableMultiStroke:G,disableMultiStrokeFill:F,preserveVertices:A,fixedDecimalPlaceDigits:j}),i.highPerformanceRestore()}drawShape(e,t,a,r,n,i,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(e,t,a,r,n,i,s,o)}};ve=m([r.injectable(),b(0,r.inject(a.DefaultCanvasArcRender)),k("design:paramtypes",[Object])],ve);let ge=class extends a.DefaultCanvasAreaRender{style="rough";drawSegmentItem(e,t,r,n,i,s,o,l,h,u,f,c){if(c)return super.drawSegmentItem(e,t,r,n,i,s,o,l,h,u,f,c);e.highPerformanceSave();const p=e.canvas.nativeCanvas,d=pe(p,{}),v=new a.CustomPath2D;a.drawAreaSegments(v,t,o,{offsetX:l,offsetY:h});const{maxRandomnessOffset:g=de.maxRandomnessOffset,roughness:y=de.roughness,bowing:m=de.bowing,curveFitting:b=de.curveFitting,curveTightness:k=de.curveTightness,curveStepCount:M=de.curveStepCount,fillStyle:S=de.fillStyle,fillWeight:x=de.fillWeight,hachureAngle:O=de.hachureAngle,hachureGap:w=de.hachureGap,simplification:P=de.simplification,dashOffset:D=de.dashOffset,dashGap:R=de.dashGap,zigzagOffset:T=de.zigzagOffset,seed:C=de.seed,fillLineDash:L=de.fillLineDash,fillLineDashOffset:z=de.fillLineDashOffset,disableMultiStroke:W=de.disableMultiStroke,disableMultiStrokeFill:G=de.disableMultiStrokeFill,preserveVertices:F=de.preserveVertices,fixedDecimalPlaceDigits:A=de.fixedDecimalPlaceDigits}=i;let{fill:j,stroke:_,lineWidth:I}=i;return Array.isArray(s)?s.forEach((e=>{j=j??e.fill,_=_??e.stroke,I=I??e.lineWidth})):(j=j??s.fill,_=_??s.stroke,I=I??s.lineWidth),d.path(v.toString(),{fill:r?j:void 0,strokeWidth:I,maxRandomnessOffset:g,roughness:y,bowing:m,curveFitting:b,curveTightness:k,curveStepCount:M,fillStyle:S,fillWeight:x,hachureAngle:O,hachureGap:w,simplification:P,dashOffset:D,dashGap:R,zigzagOffset:T,seed:C,fillLineDash:L,fillLineDashOffset:z,disableMultiStroke:W,disableMultiStrokeFill:G,preserveVertices:F,fixedDecimalPlaceDigits:A}),e.highPerformanceRestore(),!1}};ge=m([r.injectable()],ge);let ye=class{canvasRenderer;style="rough";constructor(e){this.canvasRenderer=e,this.type="circle",this.numberType=a.CIRCLE_NUMBER_TYPE}draw(e,t,r,n){const{context:i}=r;if(!i)return;const s=i.canvas.nativeCanvas,o=pe(s,{}),l=a.getTheme(e).circle;let{x:h=l.x,y:u=l.y}=e.attribute;e.transMatrix.onlyTranslate()?i.onlyTranslate()||i.clearMatrix():(h=0,u=0,i.transformFromMatrix(e.transMatrix,!0));const{radius:f=l.radius,fill:c=l.fill,stroke:p=l.stroke,lineWidth:d=l.lineWidth}=e.attribute;o.circle(h,u,f,{fill:c||void 0,stroke:p||void 0,strokeWidth:d,fillStyle:"zigzag",roughness:.5})}drawShape(e,t,a,r,n,i,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(e,t,a,r,n,i,s,o)}};ye=m([r.injectable(),b(0,r.inject(a.DefaultCanvasCircleRender)),k("design:paramtypes",[Object])],ye);let me=class extends a.DefaultCanvasLineRender{style="rough";drawSegmentItem(e,t,r,n,i,s,o,l,h,u,f,c,p,d,v){if(d||v)return super.drawSegmentItem(e,t,r,n,i,s,o,l,h,u,f,c,p,d,v);e.highPerformanceSave();const g=e.canvas.nativeCanvas,y=pe(g,{}),m=new a.CustomPath2D;a.drawSegments(e.camera?e:e.nativeContext,t,h,u,{offsetX:f,offsetY:c});const{maxRandomnessOffset:b=de.maxRandomnessOffset,roughness:k=de.roughness,bowing:M=de.bowing,curveFitting:S=de.curveFitting,curveTightness:x=de.curveTightness,curveStepCount:O=de.curveStepCount,fillStyle:w=de.fillStyle,fillWeight:P=de.fillWeight,hachureAngle:D=de.hachureAngle,hachureGap:R=de.hachureGap,simplification:T=de.simplification,dashOffset:C=de.dashOffset,dashGap:L=de.dashGap,zigzagOffset:z=de.zigzagOffset,seed:W=de.seed,fillLineDash:G=de.fillLineDash,fillLineDashOffset:F=de.fillLineDashOffset,disableMultiStroke:A=de.disableMultiStroke,disableMultiStrokeFill:j=de.disableMultiStrokeFill,preserveVertices:_=de.preserveVertices,fixedDecimalPlaceDigits:I=de.fixedDecimalPlaceDigits}=o;let{fill:E,stroke:V,lineWidth:q}=o;return Array.isArray(l)?l.forEach((e=>{E=E??e.fill,V=V??e.stroke,q=q??e.lineWidth})):(E=E??l.fill,V=V??l.stroke,q=q??l.lineWidth),y.path(m.toString(),{fill:r?E:void 0,stroke:n?V:void 0,strokeWidth:q,maxRandomnessOffset:b,roughness:k,bowing:M,curveFitting:S,curveTightness:x,curveStepCount:O,fillStyle:w,fillWeight:P,hachureAngle:D,hachureGap:R,simplification:T,dashOffset:C,dashGap:L,zigzagOffset:z,seed:W,fillLineDash:G,fillLineDashOffset:F,disableMultiStroke:A,disableMultiStrokeFill:j,preserveVertices:_,fixedDecimalPlaceDigits:I}),e.highPerformanceRestore(),!1}};me=m([r.injectable()],me);let be=class{canvasRenderer;type;numberType;style="rough";constructor(e){this.canvasRenderer=e,this.type="path",this.numberType=a.PATH_NUMBER_TYPE}draw(e,t,r,n){const{context:i}=r;if(!i)return;const s=i.canvas.nativeCanvas,o=pe(s,{});i.highPerformanceSave();const l=a.getTheme(e).path;i.transformFromMatrix(e.transMatrix,!0);const{fill:h=l.fill,stroke:u=l.stroke,lineWidth:f=l.lineWidth,path:c=l.path,maxRandomnessOffset:p=de.maxRandomnessOffset,roughness:d=de.roughness,bowing:v=de.bowing,curveFitting:g=de.curveFitting,curveTightness:y=de.curveTightness,curveStepCount:m=de.curveStepCount,fillStyle:b=de.fillStyle,fillWeight:k=de.fillWeight,hachureAngle:M=de.hachureAngle,hachureGap:S=de.hachureGap,simplification:x=de.simplification,dashOffset:O=de.dashOffset,dashGap:w=de.dashGap,zigzagOffset:P=de.zigzagOffset,seed:D=de.seed,fillLineDash:R=de.fillLineDash,fillLineDashOffset:T=de.fillLineDashOffset,disableMultiStroke:C=de.disableMultiStroke,disableMultiStrokeFill:L=de.disableMultiStrokeFill,preserveVertices:z=de.preserveVertices,fixedDecimalPlaceDigits:W=de.fixedDecimalPlaceDigits}=e.attribute;"string"==typeof c&&o.path(c,{fill:h||void 0,stroke:u||void 0,strokeWidth:f,maxRandomnessOffset:p,roughness:d,bowing:v,curveFitting:g,curveTightness:y,curveStepCount:m,fillStyle:b,fillWeight:k,hachureAngle:M,hachureGap:S,simplification:x,dashOffset:O,dashGap:w,zigzagOffset:P,seed:D,fillLineDash:R,fillLineDashOffset:T,disableMultiStroke:C,disableMultiStrokeFill:L,preserveVertices:z,fixedDecimalPlaceDigits:W}),i.highPerformanceRestore()}drawShape(e,t,a,r,n,i,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(e,t,a,r,n,i,s,o)}};be=m([r.injectable(),b(0,r.inject(a.DefaultCanvasPathRender)),k("design:paramtypes",[Object])],be);let ke=class{canvasRenderer;type;numberType;style="rough";constructor(e){this.canvasRenderer=e,this.type="rect",this.numberType=a.RECT_NUMBER_TYPE}draw(e,t,r,n){const{context:i}=r;if(!i)return;const s=i.canvas.nativeCanvas,o=pe(s);i.highPerformanceSave();const l=a.getTheme(e).rect;let{x:h=l.x,y:u=l.y}=e.attribute;if(e.transMatrix.onlyTranslate()){const{dx:t=l.dx,dy:a=l.dy}=e.attribute;h+=t,u+=a,i.setTransformForCurrent()}else h=0,u=0,i.transformFromMatrix(e.transMatrix,!0);const{fill:f=l.fill,stroke:c=l.stroke,fillColor:p=l.fill,strokeColor:d=l.stroke,width:v=l.width,height:g=l.height,lineWidth:y=l.lineWidth,maxRandomnessOffset:m=de.maxRandomnessOffset,roughness:b=de.roughness,bowing:k=de.bowing,curveFitting:M=de.curveFitting,curveTightness:S=de.curveTightness,curveStepCount:x=de.curveStepCount,fillStyle:O=de.fillStyle,fillWeight:w=de.fillWeight,hachureAngle:P=de.hachureAngle,hachureGap:D=de.hachureGap,simplification:R=de.simplification,dashOffset:T=de.dashOffset,dashGap:C=de.dashGap,zigzagOffset:L=de.zigzagOffset,seed:z=de.seed,fillLineDash:W=de.fillLineDash,fillLineDashOffset:G=de.fillLineDashOffset,disableMultiStroke:F=de.disableMultiStroke,disableMultiStrokeFill:A=de.disableMultiStrokeFill,preserveVertices:j=de.preserveVertices,fixedDecimalPlaceDigits:_=de.fixedDecimalPlaceDigits}=e.attribute;o.rectangle(h,u,v,g,{fill:f?p:void 0,stroke:c?d:void 0,strokeWidth:y,maxRandomnessOffset:m,roughness:b,bowing:k,curveFitting:M,curveTightness:S,curveStepCount:x,fillStyle:O,fillWeight:w,hachureAngle:P,hachureGap:D,simplification:R,dashOffset:T,dashGap:C,zigzagOffset:L,seed:z,fillLineDash:W,fillLineDashOffset:G,disableMultiStroke:F,disableMultiStrokeFill:A,preserveVertices:j,fixedDecimalPlaceDigits:_}),i.highPerformanceRestore()}drawShape(e,t,a,r,n,i,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(e,t,a,r,n,i,s,o)}};ke=m([r.injectable(),b(0,r.inject(a.DefaultCanvasRectRender)),k("design:paramtypes",[Object])],ke);let Me=class{canvasRenderer;type;numberType;style="rough";constructor(e){this.canvasRenderer=e,this.type="symbol",this.numberType=a.SYMBOL_NUMBER_TYPE}draw(e,t,r,n){const{context:i}=r;if(!i)return;const s=i.canvas.nativeCanvas,o=pe(s);i.highPerformanceSave();const l=a.getTheme(e).symbol;let{x:h=l.x,y:u=l.y}=e.attribute;if(e.transMatrix.onlyTranslate()){const{dx:t=l.dx,dy:a=l.dy}=e.attribute;h+=t,u+=a,i.setTransformForCurrent()}else h=0,u=0,i.transformFromMatrix(e.transMatrix,!0);const f=e.getParsedPath();if(!f)return;const{fill:c=l.fill,stroke:p=l.stroke,fillColor:d=l.fill,strokeColor:v=l.stroke,size:g=l.size,lineWidth:y=l.lineWidth,maxRandomnessOffset:m=de.maxRandomnessOffset,roughness:b=de.roughness,bowing:k=de.bowing,curveFitting:M=de.curveFitting,curveTightness:S=de.curveTightness,curveStepCount:x=de.curveStepCount,fillStyle:O=de.fillStyle,fillWeight:w=de.fillWeight,hachureAngle:P=de.hachureAngle,hachureGap:D=de.hachureGap,simplification:R=de.simplification,dashOffset:T=de.dashOffset,dashGap:C=de.dashGap,zigzagOffset:L=de.zigzagOffset,seed:z=de.seed,fillLineDash:W=de.fillLineDash,fillLineDashOffset:G=de.fillLineDashOffset,disableMultiStroke:F=de.disableMultiStroke,disableMultiStrokeFill:A=de.disableMultiStrokeFill,preserveVertices:j=de.preserveVertices,fixedDecimalPlaceDigits:_=de.fixedDecimalPlaceDigits}=e.attribute,I=new a.CustomPath2D;f.draw(I,g,h,u)&&I.closePath(),o.path(I.toString(),{fill:c?d:void 0,stroke:p?v:void 0,strokeWidth:y,maxRandomnessOffset:m,roughness:b,bowing:k,curveFitting:M,curveTightness:S,curveStepCount:x,fillStyle:O,fillWeight:w,hachureAngle:P,hachureGap:D,simplification:R,dashOffset:T,dashGap:C,zigzagOffset:L,seed:z,fillLineDash:W,fillLineDashOffset:G,disableMultiStroke:F,disableMultiStrokeFill:A,preserveVertices:j,fixedDecimalPlaceDigits:_}),i.highPerformanceRestore()}drawShape(e,t,a,r,n,i,s,o){if(this.canvasRenderer.drawShape)return this.canvasRenderer.drawShape(e,t,a,r,n,i,s,o)}};Me=m([r.injectable(),b(0,r.inject(a.DefaultCanvasSymbolRender)),k("design:paramtypes",[Object])],Me);const Se=new r.ContainerModule(((e,t,r,n)=>{e(ye).toSelf().inSingletonScope(),e(a.GraphicRender).to(ye),e(ke).toSelf().inSingletonScope(),e(a.GraphicRender).to(ke),e(be).toSelf().inSingletonScope(),e(a.GraphicRender).to(be),e(Me).toSelf().inSingletonScope(),e(a.GraphicRender).to(Me),e(me).toSelf().inSingletonScope(),e(a.GraphicRender).to(me),e(ge).toSelf().inSingletonScope(),e(a.GraphicRender).to(ge),e(ve).toSelf().inSingletonScope(),e(a.GraphicRender).to(ve)}));e.roughModule=Se}));
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('@visactor/vrender'), require('inversify')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'reflect-metadata', '@visactor/vrender', 'inversify'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.VRender = global.VRender || {}, global.VRender.Kits = {}), global.reflectMetadata, global.VRender, global.inversify));
|
|
5
|
+
})(this, (function (exports, reflectMetadata, vrender, inversify) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _iterableToArrayLimit(arr, i) {
|
|
8
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
9
|
+
if (null != _i) {
|
|
10
|
+
var _s,
|
|
11
|
+
_e,
|
|
12
|
+
_x,
|
|
13
|
+
_r,
|
|
14
|
+
_arr = [],
|
|
15
|
+
_n = !0,
|
|
16
|
+
_d = !1;
|
|
17
|
+
try {
|
|
18
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
19
|
+
if (Object(_i) !== _i) return;
|
|
20
|
+
_n = !1;
|
|
21
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
_d = !0, _e = err;
|
|
24
|
+
} finally {
|
|
25
|
+
try {
|
|
26
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
27
|
+
} finally {
|
|
28
|
+
if (_d) throw _e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return _arr;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function _typeof(obj) {
|
|
35
|
+
"@babel/helpers - typeof";
|
|
36
|
+
|
|
37
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
38
|
+
return typeof obj;
|
|
39
|
+
} : function (obj) {
|
|
40
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
41
|
+
}, _typeof(obj);
|
|
42
|
+
}
|
|
43
|
+
function _classCallCheck(instance, Constructor) {
|
|
44
|
+
if (!(instance instanceof Constructor)) {
|
|
45
|
+
throw new TypeError("Cannot call a class as a function");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function _defineProperties(target, props) {
|
|
49
|
+
for (var i = 0; i < props.length; i++) {
|
|
50
|
+
var descriptor = props[i];
|
|
51
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
52
|
+
descriptor.configurable = true;
|
|
53
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
54
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
58
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
59
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
60
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
61
|
+
writable: false
|
|
62
|
+
});
|
|
63
|
+
return Constructor;
|
|
64
|
+
}
|
|
65
|
+
function _inherits(subClass, superClass) {
|
|
66
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
67
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
68
|
+
}
|
|
69
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
70
|
+
constructor: {
|
|
71
|
+
value: subClass,
|
|
72
|
+
writable: true,
|
|
73
|
+
configurable: true
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(subClass, "prototype", {
|
|
77
|
+
writable: false
|
|
78
|
+
});
|
|
79
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
80
|
+
}
|
|
81
|
+
function _getPrototypeOf(o) {
|
|
82
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
83
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
84
|
+
};
|
|
85
|
+
return _getPrototypeOf(o);
|
|
86
|
+
}
|
|
87
|
+
function _setPrototypeOf(o, p) {
|
|
88
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
89
|
+
o.__proto__ = p;
|
|
90
|
+
return o;
|
|
91
|
+
};
|
|
92
|
+
return _setPrototypeOf(o, p);
|
|
93
|
+
}
|
|
94
|
+
function _isNativeReflectConstruct() {
|
|
95
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
96
|
+
if (Reflect.construct.sham) return false;
|
|
97
|
+
if (typeof Proxy === "function") return true;
|
|
98
|
+
try {
|
|
99
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
100
|
+
return true;
|
|
101
|
+
} catch (e) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function _assertThisInitialized(self) {
|
|
106
|
+
if (self === void 0) {
|
|
107
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
108
|
+
}
|
|
109
|
+
return self;
|
|
110
|
+
}
|
|
111
|
+
function _possibleConstructorReturn(self, call) {
|
|
112
|
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
113
|
+
return call;
|
|
114
|
+
} else if (call !== void 0) {
|
|
115
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
116
|
+
}
|
|
117
|
+
return _assertThisInitialized(self);
|
|
118
|
+
}
|
|
119
|
+
function _createSuper(Derived) {
|
|
120
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
121
|
+
return function _createSuperInternal() {
|
|
122
|
+
var Super = _getPrototypeOf(Derived),
|
|
123
|
+
result;
|
|
124
|
+
if (hasNativeReflectConstruct) {
|
|
125
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
126
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
127
|
+
} else {
|
|
128
|
+
result = Super.apply(this, arguments);
|
|
129
|
+
}
|
|
130
|
+
return _possibleConstructorReturn(this, result);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function _slicedToArray(arr, i) {
|
|
134
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
135
|
+
}
|
|
136
|
+
function _toConsumableArray(arr) {
|
|
137
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
138
|
+
}
|
|
139
|
+
function _arrayWithoutHoles(arr) {
|
|
140
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
141
|
+
}
|
|
142
|
+
function _arrayWithHoles(arr) {
|
|
143
|
+
if (Array.isArray(arr)) return arr;
|
|
144
|
+
}
|
|
145
|
+
function _iterableToArray(iter) {
|
|
146
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
147
|
+
}
|
|
148
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
149
|
+
if (!o) return;
|
|
150
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
151
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
152
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
153
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
154
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
155
|
+
}
|
|
156
|
+
function _arrayLikeToArray(arr, len) {
|
|
157
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
158
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
159
|
+
return arr2;
|
|
160
|
+
}
|
|
161
|
+
function _nonIterableSpread() {
|
|
162
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
163
|
+
}
|
|
164
|
+
function _nonIterableRest() {
|
|
165
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
166
|
+
}
|
|
167
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
168
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
169
|
+
if (!it) {
|
|
170
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
171
|
+
if (it) o = it;
|
|
172
|
+
var i = 0;
|
|
173
|
+
var F = function () {};
|
|
174
|
+
return {
|
|
175
|
+
s: F,
|
|
176
|
+
n: function () {
|
|
177
|
+
if (i >= o.length) return {
|
|
178
|
+
done: true
|
|
179
|
+
};
|
|
180
|
+
return {
|
|
181
|
+
done: false,
|
|
182
|
+
value: o[i++]
|
|
183
|
+
};
|
|
184
|
+
},
|
|
185
|
+
e: function (e) {
|
|
186
|
+
throw e;
|
|
187
|
+
},
|
|
188
|
+
f: F
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
192
|
+
}
|
|
193
|
+
var normalCompletion = true,
|
|
194
|
+
didErr = false,
|
|
195
|
+
err;
|
|
196
|
+
return {
|
|
197
|
+
s: function () {
|
|
198
|
+
it = it.call(o);
|
|
199
|
+
},
|
|
200
|
+
n: function () {
|
|
201
|
+
var step = it.next();
|
|
202
|
+
normalCompletion = step.done;
|
|
203
|
+
return step;
|
|
204
|
+
},
|
|
205
|
+
e: function (e) {
|
|
206
|
+
didErr = true;
|
|
207
|
+
err = e;
|
|
208
|
+
},
|
|
209
|
+
f: function () {
|
|
210
|
+
try {
|
|
211
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
212
|
+
} finally {
|
|
213
|
+
if (didErr) throw err;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function _toPrimitive(input, hint) {
|
|
219
|
+
if (typeof input !== "object" || input === null) return input;
|
|
220
|
+
var prim = input[Symbol.toPrimitive];
|
|
221
|
+
if (prim !== undefined) {
|
|
222
|
+
var res = prim.call(input, hint || "default");
|
|
223
|
+
if (typeof res !== "object") return res;
|
|
224
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
225
|
+
}
|
|
226
|
+
return (hint === "string" ? String : Number)(input);
|
|
227
|
+
}
|
|
228
|
+
function _toPropertyKey(arg) {
|
|
229
|
+
var key = _toPrimitive(arg, "string");
|
|
230
|
+
return typeof key === "symbol" ? key : String(key);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function __decorate(decorators, target, key, desc) {
|
|
234
|
+
var c = arguments.length,
|
|
235
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
236
|
+
d;
|
|
237
|
+
if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
238
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
239
|
+
}
|
|
240
|
+
function __param(paramIndex, decorator) {
|
|
241
|
+
return function (target, key) {
|
|
242
|
+
decorator(target, key, paramIndex);
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function __metadata(metadataKey, metadataValue) {
|
|
246
|
+
if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function t(t, e, s) {
|
|
250
|
+
if (t && t.length) {
|
|
251
|
+
var _e = _slicedToArray(e, 2),
|
|
252
|
+
_n = _e[0],
|
|
253
|
+
_a = _e[1],
|
|
254
|
+
_o = Math.PI / 180 * s,
|
|
255
|
+
_h = Math.cos(_o),
|
|
256
|
+
_r = Math.sin(_o);
|
|
257
|
+
t.forEach(function (t) {
|
|
258
|
+
var _t = _slicedToArray(t, 2),
|
|
259
|
+
e = _t[0],
|
|
260
|
+
s = _t[1];
|
|
261
|
+
t[0] = (e - _n) * _h - (s - _a) * _r + _n, t[1] = (e - _n) * _r + (s - _a) * _h + _a;
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function e(t) {
|
|
266
|
+
var e = t[0],
|
|
267
|
+
s = t[1];
|
|
268
|
+
return Math.sqrt(Math.pow(e[0] - s[0], 2) + Math.pow(e[1] - s[1], 2));
|
|
269
|
+
}
|
|
270
|
+
function s(e, s) {
|
|
271
|
+
var n = s.hachureAngle + 90;
|
|
272
|
+
var a = s.hachureGap;
|
|
273
|
+
a < 0 && (a = 4 * s.strokeWidth), a = Math.max(a, .1);
|
|
274
|
+
var o = [0, 0];
|
|
275
|
+
if (n) {
|
|
276
|
+
var _iterator = _createForOfIteratorHelper(e),
|
|
277
|
+
_step;
|
|
278
|
+
try {
|
|
279
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
280
|
+
var _s = _step.value;
|
|
281
|
+
t(_s, o, n);
|
|
282
|
+
}
|
|
283
|
+
} catch (err) {
|
|
284
|
+
_iterator.e(err);
|
|
285
|
+
} finally {
|
|
286
|
+
_iterator.f();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
var h = function (t, e) {
|
|
290
|
+
var s = [];
|
|
291
|
+
var _iterator2 = _createForOfIteratorHelper(t),
|
|
292
|
+
_step2;
|
|
293
|
+
try {
|
|
294
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
295
|
+
var _e5 = _step2.value;
|
|
296
|
+
var _t6 = _toConsumableArray(_e5);
|
|
297
|
+
_t6[0].join(",") !== _t6[_t6.length - 1].join(",") && _t6.push([_t6[0][0], _t6[0][1]]), _t6.length > 2 && s.push(_t6);
|
|
298
|
+
}
|
|
299
|
+
} catch (err) {
|
|
300
|
+
_iterator2.e(err);
|
|
301
|
+
} finally {
|
|
302
|
+
_iterator2.f();
|
|
303
|
+
}
|
|
304
|
+
var n = [];
|
|
305
|
+
e = Math.max(e, .1);
|
|
306
|
+
var a = [];
|
|
307
|
+
for (var _i = 0, _s2 = s; _i < _s2.length; _i++) {
|
|
308
|
+
var _t2 = _s2[_i];
|
|
309
|
+
for (var _e2 = 0; _e2 < _t2.length - 1; _e2++) {
|
|
310
|
+
var _s3 = _t2[_e2],
|
|
311
|
+
_n2 = _t2[_e2 + 1];
|
|
312
|
+
if (_s3[1] !== _n2[1]) {
|
|
313
|
+
var _t3 = Math.min(_s3[1], _n2[1]);
|
|
314
|
+
a.push({
|
|
315
|
+
ymin: _t3,
|
|
316
|
+
ymax: Math.max(_s3[1], _n2[1]),
|
|
317
|
+
x: _t3 === _s3[1] ? _s3[0] : _n2[0],
|
|
318
|
+
islope: (_n2[0] - _s3[0]) / (_n2[1] - _s3[1])
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (a.sort(function (t, e) {
|
|
324
|
+
return t.ymin < e.ymin ? -1 : t.ymin > e.ymin ? 1 : t.x < e.x ? -1 : t.x > e.x ? 1 : t.ymax === e.ymax ? 0 : (t.ymax - e.ymax) / Math.abs(t.ymax - e.ymax);
|
|
325
|
+
}), !a.length) return n;
|
|
326
|
+
var o = [],
|
|
327
|
+
h = a[0].ymin;
|
|
328
|
+
for (; o.length || a.length;) {
|
|
329
|
+
if (a.length) {
|
|
330
|
+
var _t4 = -1;
|
|
331
|
+
for (var _e3 = 0; _e3 < a.length && !(a[_e3].ymin > h); _e3++) _t4 = _e3;
|
|
332
|
+
a.splice(0, _t4 + 1).forEach(function (t) {
|
|
333
|
+
o.push({
|
|
334
|
+
s: h,
|
|
335
|
+
edge: t
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
if (o = o.filter(function (t) {
|
|
340
|
+
return !(t.edge.ymax <= h);
|
|
341
|
+
}), o.sort(function (t, e) {
|
|
342
|
+
return t.edge.x === e.edge.x ? 0 : (t.edge.x - e.edge.x) / Math.abs(t.edge.x - e.edge.x);
|
|
343
|
+
}), o.length > 1) for (var _t5 = 0; _t5 < o.length; _t5 += 2) {
|
|
344
|
+
var _e4 = _t5 + 1;
|
|
345
|
+
if (_e4 >= o.length) break;
|
|
346
|
+
var _s4 = o[_t5].edge,
|
|
347
|
+
_a2 = o[_e4].edge;
|
|
348
|
+
n.push([[Math.round(_s4.x), h], [Math.round(_a2.x), h]]);
|
|
349
|
+
}
|
|
350
|
+
h += e, o.forEach(function (t) {
|
|
351
|
+
t.edge.x = t.edge.x + e * t.edge.islope;
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
return n;
|
|
355
|
+
}(e, a);
|
|
356
|
+
if (n) {
|
|
357
|
+
var _iterator3 = _createForOfIteratorHelper(e),
|
|
358
|
+
_step3;
|
|
359
|
+
try {
|
|
360
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
361
|
+
var _s5 = _step3.value;
|
|
362
|
+
t(_s5, o, -n);
|
|
363
|
+
}
|
|
364
|
+
} catch (err) {
|
|
365
|
+
_iterator3.e(err);
|
|
366
|
+
} finally {
|
|
367
|
+
_iterator3.f();
|
|
368
|
+
}
|
|
369
|
+
!function (e, s, n) {
|
|
370
|
+
var a = [];
|
|
371
|
+
e.forEach(function (t) {
|
|
372
|
+
return a.push.apply(a, _toConsumableArray(t));
|
|
373
|
+
}), t(a, s, n);
|
|
374
|
+
}(h, o, -n);
|
|
375
|
+
}
|
|
376
|
+
return h;
|
|
377
|
+
}
|
|
378
|
+
var n = /*#__PURE__*/function () {
|
|
379
|
+
function n(t) {
|
|
380
|
+
_classCallCheck(this, n);
|
|
381
|
+
this.helper = t;
|
|
382
|
+
}
|
|
383
|
+
_createClass(n, [{
|
|
384
|
+
key: "fillPolygons",
|
|
385
|
+
value: function fillPolygons(t, e) {
|
|
386
|
+
return this._fillPolygons(t, e);
|
|
387
|
+
}
|
|
388
|
+
}, {
|
|
389
|
+
key: "_fillPolygons",
|
|
390
|
+
value: function _fillPolygons(t, e) {
|
|
391
|
+
var _n3 = s(t, e);
|
|
392
|
+
return {
|
|
393
|
+
type: "fillSketch",
|
|
394
|
+
ops: this.renderLines(_n3, e)
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
}, {
|
|
398
|
+
key: "renderLines",
|
|
399
|
+
value: function renderLines(t, e) {
|
|
400
|
+
var s = [];
|
|
401
|
+
var _iterator4 = _createForOfIteratorHelper(t),
|
|
402
|
+
_step4;
|
|
403
|
+
try {
|
|
404
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
405
|
+
var _n4 = _step4.value;
|
|
406
|
+
s.push.apply(s, _toConsumableArray(this.helper.doubleLineOps(_n4[0][0], _n4[0][1], _n4[1][0], _n4[1][1], e)));
|
|
407
|
+
}
|
|
408
|
+
} catch (err) {
|
|
409
|
+
_iterator4.e(err);
|
|
410
|
+
} finally {
|
|
411
|
+
_iterator4.f();
|
|
412
|
+
}
|
|
413
|
+
return s;
|
|
414
|
+
}
|
|
415
|
+
}]);
|
|
416
|
+
return n;
|
|
417
|
+
}();
|
|
418
|
+
var a = /*#__PURE__*/function (_n5) {
|
|
419
|
+
_inherits(a, _n5);
|
|
420
|
+
var _super = _createSuper(a);
|
|
421
|
+
function a() {
|
|
422
|
+
_classCallCheck(this, a);
|
|
423
|
+
return _super.apply(this, arguments);
|
|
424
|
+
}
|
|
425
|
+
_createClass(a, [{
|
|
426
|
+
key: "fillPolygons",
|
|
427
|
+
value: function fillPolygons(t, n) {
|
|
428
|
+
var _a3 = n.hachureGap;
|
|
429
|
+
_a3 < 0 && (_a3 = 4 * n.strokeWidth), _a3 = Math.max(_a3, .1);
|
|
430
|
+
var o = s(t, Object.assign({}, n, {
|
|
431
|
+
hachureGap: _a3
|
|
432
|
+
})),
|
|
433
|
+
h = Math.PI / 180 * n.hachureAngle,
|
|
434
|
+
r = [],
|
|
435
|
+
i = .5 * _a3 * Math.cos(h),
|
|
436
|
+
c = .5 * _a3 * Math.sin(h);
|
|
437
|
+
var _iterator5 = _createForOfIteratorHelper(o),
|
|
438
|
+
_step5;
|
|
439
|
+
try {
|
|
440
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
441
|
+
var _step5$value = _slicedToArray(_step5.value, 2),
|
|
442
|
+
_t7 = _step5$value[0],
|
|
443
|
+
_s6 = _step5$value[1];
|
|
444
|
+
e([_t7, _s6]) && r.push([[_t7[0] - i, _t7[1] + c], _toConsumableArray(_s6)], [[_t7[0] + i, _t7[1] - c], _toConsumableArray(_s6)]);
|
|
445
|
+
}
|
|
446
|
+
} catch (err) {
|
|
447
|
+
_iterator5.e(err);
|
|
448
|
+
} finally {
|
|
449
|
+
_iterator5.f();
|
|
450
|
+
}
|
|
451
|
+
return {
|
|
452
|
+
type: "fillSketch",
|
|
453
|
+
ops: this.renderLines(r, n)
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
}]);
|
|
457
|
+
return a;
|
|
458
|
+
}(n);
|
|
459
|
+
var o = /*#__PURE__*/function (_n6) {
|
|
460
|
+
_inherits(o, _n6);
|
|
461
|
+
var _super2 = _createSuper(o);
|
|
462
|
+
function o() {
|
|
463
|
+
_classCallCheck(this, o);
|
|
464
|
+
return _super2.apply(this, arguments);
|
|
465
|
+
}
|
|
466
|
+
_createClass(o, [{
|
|
467
|
+
key: "fillPolygons",
|
|
468
|
+
value: function fillPolygons(t, e) {
|
|
469
|
+
var s = this._fillPolygons(t, e),
|
|
470
|
+
n = Object.assign({}, e, {
|
|
471
|
+
hachureAngle: e.hachureAngle + 90
|
|
472
|
+
}),
|
|
473
|
+
a = this._fillPolygons(t, n);
|
|
474
|
+
return s.ops = s.ops.concat(a.ops), s;
|
|
475
|
+
}
|
|
476
|
+
}]);
|
|
477
|
+
return o;
|
|
478
|
+
}(n);
|
|
479
|
+
var h = /*#__PURE__*/function () {
|
|
480
|
+
function h(t) {
|
|
481
|
+
_classCallCheck(this, h);
|
|
482
|
+
this.helper = t;
|
|
483
|
+
}
|
|
484
|
+
_createClass(h, [{
|
|
485
|
+
key: "fillPolygons",
|
|
486
|
+
value: function fillPolygons(t, e) {
|
|
487
|
+
var n = s(t, e = Object.assign({}, e, {
|
|
488
|
+
hachureAngle: 0
|
|
489
|
+
}));
|
|
490
|
+
return this.dotsOnLines(n, e);
|
|
491
|
+
}
|
|
492
|
+
}, {
|
|
493
|
+
key: "dotsOnLines",
|
|
494
|
+
value: function dotsOnLines(t, s) {
|
|
495
|
+
var n = [];
|
|
496
|
+
var a = s.hachureGap;
|
|
497
|
+
a < 0 && (a = 4 * s.strokeWidth), a = Math.max(a, .1);
|
|
498
|
+
var o = s.fillWeight;
|
|
499
|
+
o < 0 && (o = s.strokeWidth / 2);
|
|
500
|
+
var _h2 = a / 4;
|
|
501
|
+
var _iterator6 = _createForOfIteratorHelper(t),
|
|
502
|
+
_step6;
|
|
503
|
+
try {
|
|
504
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
505
|
+
var _r2 = _step6.value;
|
|
506
|
+
var _t8 = e(_r2),
|
|
507
|
+
_i2 = _t8 / a,
|
|
508
|
+
_c = Math.ceil(_i2) - 1,
|
|
509
|
+
_l = _t8 - _c * a,
|
|
510
|
+
_u = (_r2[0][0] + _r2[1][0]) / 2 - a / 4,
|
|
511
|
+
_p = Math.min(_r2[0][1], _r2[1][1]);
|
|
512
|
+
for (var _t9 = 0; _t9 < _c; _t9++) {
|
|
513
|
+
var _e6 = _p + _l + _t9 * a,
|
|
514
|
+
_r3 = _u - _h2 + 2 * Math.random() * _h2,
|
|
515
|
+
_i3 = _e6 - _h2 + 2 * Math.random() * _h2,
|
|
516
|
+
_c2 = this.helper.ellipse(_r3, _i3, o, o, s);
|
|
517
|
+
n.push.apply(n, _toConsumableArray(_c2.ops));
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
} catch (err) {
|
|
521
|
+
_iterator6.e(err);
|
|
522
|
+
} finally {
|
|
523
|
+
_iterator6.f();
|
|
524
|
+
}
|
|
525
|
+
return {
|
|
526
|
+
type: "fillSketch",
|
|
527
|
+
ops: n
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
}]);
|
|
531
|
+
return h;
|
|
532
|
+
}();
|
|
533
|
+
var r = /*#__PURE__*/function () {
|
|
534
|
+
function r(t) {
|
|
535
|
+
_classCallCheck(this, r);
|
|
536
|
+
this.helper = t;
|
|
537
|
+
}
|
|
538
|
+
_createClass(r, [{
|
|
539
|
+
key: "fillPolygons",
|
|
540
|
+
value: function fillPolygons(t, e) {
|
|
541
|
+
var n = s(t, e);
|
|
542
|
+
return {
|
|
543
|
+
type: "fillSketch",
|
|
544
|
+
ops: this.dashedLine(n, e)
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
}, {
|
|
548
|
+
key: "dashedLine",
|
|
549
|
+
value: function dashedLine(t, s) {
|
|
550
|
+
var _this = this;
|
|
551
|
+
var n = s.dashOffset < 0 ? s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap : s.dashOffset,
|
|
552
|
+
a = s.dashGap < 0 ? s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap : s.dashGap,
|
|
553
|
+
o = [];
|
|
554
|
+
return t.forEach(function (t) {
|
|
555
|
+
var h = e(t),
|
|
556
|
+
_r4 = Math.floor(h / (n + a)),
|
|
557
|
+
i = (h + a - _r4 * (n + a)) / 2;
|
|
558
|
+
var c = t[0],
|
|
559
|
+
l = t[1];
|
|
560
|
+
c[0] > l[0] && (c = t[1], l = t[0]);
|
|
561
|
+
var u = Math.atan((l[1] - c[1]) / (l[0] - c[0]));
|
|
562
|
+
for (var _t10 = 0; _t10 < _r4; _t10++) {
|
|
563
|
+
var _e7 = _t10 * (n + a),
|
|
564
|
+
_h3 = _e7 + n,
|
|
565
|
+
_r5 = [c[0] + _e7 * Math.cos(u) + i * Math.cos(u), c[1] + _e7 * Math.sin(u) + i * Math.sin(u)],
|
|
566
|
+
_l2 = [c[0] + _h3 * Math.cos(u) + i * Math.cos(u), c[1] + _h3 * Math.sin(u) + i * Math.sin(u)];
|
|
567
|
+
o.push.apply(o, _toConsumableArray(_this.helper.doubleLineOps(_r5[0], _r5[1], _l2[0], _l2[1], s)));
|
|
568
|
+
}
|
|
569
|
+
}), o;
|
|
570
|
+
}
|
|
571
|
+
}]);
|
|
572
|
+
return r;
|
|
573
|
+
}();
|
|
574
|
+
var i = /*#__PURE__*/function () {
|
|
575
|
+
function i(t) {
|
|
576
|
+
_classCallCheck(this, i);
|
|
577
|
+
this.helper = t;
|
|
578
|
+
}
|
|
579
|
+
_createClass(i, [{
|
|
580
|
+
key: "fillPolygons",
|
|
581
|
+
value: function fillPolygons(t, e) {
|
|
582
|
+
var n = e.hachureGap < 0 ? 4 * e.strokeWidth : e.hachureGap,
|
|
583
|
+
a = e.zigzagOffset < 0 ? n : e.zigzagOffset,
|
|
584
|
+
o = s(t, e = Object.assign({}, e, {
|
|
585
|
+
hachureGap: n + a
|
|
586
|
+
}));
|
|
587
|
+
return {
|
|
588
|
+
type: "fillSketch",
|
|
589
|
+
ops: this.zigzagLines(o, a, e)
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
}, {
|
|
593
|
+
key: "zigzagLines",
|
|
594
|
+
value: function zigzagLines(t, s, n) {
|
|
595
|
+
var _this2 = this;
|
|
596
|
+
var a = [];
|
|
597
|
+
return t.forEach(function (t) {
|
|
598
|
+
var o = e(t),
|
|
599
|
+
h = Math.round(o / (2 * s));
|
|
600
|
+
var r = t[0],
|
|
601
|
+
_i4 = t[1];
|
|
602
|
+
r[0] > _i4[0] && (r = t[1], _i4 = t[0]);
|
|
603
|
+
var c = Math.atan((_i4[1] - r[1]) / (_i4[0] - r[0]));
|
|
604
|
+
for (var _t11 = 0; _t11 < h; _t11++) {
|
|
605
|
+
var _e8 = 2 * _t11 * s,
|
|
606
|
+
_o2 = 2 * (_t11 + 1) * s,
|
|
607
|
+
_h4 = Math.sqrt(2 * Math.pow(s, 2)),
|
|
608
|
+
_i5 = [r[0] + _e8 * Math.cos(c), r[1] + _e8 * Math.sin(c)],
|
|
609
|
+
_l3 = [r[0] + _o2 * Math.cos(c), r[1] + _o2 * Math.sin(c)],
|
|
610
|
+
_u2 = [_i5[0] + _h4 * Math.cos(c + Math.PI / 4), _i5[1] + _h4 * Math.sin(c + Math.PI / 4)];
|
|
611
|
+
a.push.apply(a, _toConsumableArray(_this2.helper.doubleLineOps(_i5[0], _i5[1], _u2[0], _u2[1], n)).concat(_toConsumableArray(_this2.helper.doubleLineOps(_u2[0], _u2[1], _l3[0], _l3[1], n))));
|
|
612
|
+
}
|
|
613
|
+
}), a;
|
|
614
|
+
}
|
|
615
|
+
}]);
|
|
616
|
+
return i;
|
|
617
|
+
}();
|
|
618
|
+
var c = {};
|
|
619
|
+
var l = /*#__PURE__*/function () {
|
|
620
|
+
function l(t) {
|
|
621
|
+
_classCallCheck(this, l);
|
|
622
|
+
this.seed = t;
|
|
623
|
+
}
|
|
624
|
+
_createClass(l, [{
|
|
625
|
+
key: "next",
|
|
626
|
+
value: function next() {
|
|
627
|
+
return this.seed ? (Math.pow(2, 31) - 1 & (this.seed = Math.imul(48271, this.seed))) / Math.pow(2, 31) : Math.random();
|
|
628
|
+
}
|
|
629
|
+
}]);
|
|
630
|
+
return l;
|
|
631
|
+
}();
|
|
632
|
+
var u = {
|
|
633
|
+
A: 7,
|
|
634
|
+
a: 7,
|
|
635
|
+
C: 6,
|
|
636
|
+
c: 6,
|
|
637
|
+
H: 1,
|
|
638
|
+
h: 1,
|
|
639
|
+
L: 2,
|
|
640
|
+
l: 2,
|
|
641
|
+
M: 2,
|
|
642
|
+
m: 2,
|
|
643
|
+
Q: 4,
|
|
644
|
+
q: 4,
|
|
645
|
+
S: 4,
|
|
646
|
+
s: 4,
|
|
647
|
+
T: 2,
|
|
648
|
+
t: 2,
|
|
649
|
+
V: 1,
|
|
650
|
+
v: 1,
|
|
651
|
+
Z: 0,
|
|
652
|
+
z: 0
|
|
653
|
+
};
|
|
654
|
+
function p(t, e) {
|
|
655
|
+
return t.type === e;
|
|
656
|
+
}
|
|
657
|
+
function f(t) {
|
|
658
|
+
var e = [],
|
|
659
|
+
s = function (t) {
|
|
660
|
+
var e = new Array();
|
|
661
|
+
for (; "" !== t;) if (t.match(/^([ \t\r\n,]+)/)) t = t.substr(RegExp.$1.length);else if (t.match(/^([aAcChHlLmMqQsStTvVzZ])/)) e[e.length] = {
|
|
662
|
+
type: 0,
|
|
663
|
+
text: RegExp.$1
|
|
664
|
+
}, t = t.substr(RegExp.$1.length);else {
|
|
665
|
+
if (!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return [];
|
|
666
|
+
e[e.length] = {
|
|
667
|
+
type: 1,
|
|
668
|
+
text: "".concat(parseFloat(RegExp.$1))
|
|
669
|
+
}, t = t.substr(RegExp.$1.length);
|
|
670
|
+
}
|
|
671
|
+
return e[e.length] = {
|
|
672
|
+
type: 2,
|
|
673
|
+
text: ""
|
|
674
|
+
}, e;
|
|
675
|
+
}(t);
|
|
676
|
+
var n = "BOD",
|
|
677
|
+
a = 0,
|
|
678
|
+
o = s[a];
|
|
679
|
+
for (; !p(o, 2);) {
|
|
680
|
+
var _h5 = 0;
|
|
681
|
+
var _r6 = [];
|
|
682
|
+
if ("BOD" === n) {
|
|
683
|
+
if ("M" !== o.text && "m" !== o.text) return f("M0,0" + t);
|
|
684
|
+
a++, _h5 = u[o.text], n = o.text;
|
|
685
|
+
} else p(o, 1) ? _h5 = u[n] : (a++, _h5 = u[o.text], n = o.text);
|
|
686
|
+
if (!(a + _h5 < s.length)) throw new Error("Path data ended short");
|
|
687
|
+
for (var _t12 = a; _t12 < a + _h5; _t12++) {
|
|
688
|
+
var _e9 = s[_t12];
|
|
689
|
+
if (!p(_e9, 1)) throw new Error("Param not a number: " + n + "," + _e9.text);
|
|
690
|
+
_r6[_r6.length] = +_e9.text;
|
|
691
|
+
}
|
|
692
|
+
if ("number" != typeof u[n]) throw new Error("Bad segment: " + n);
|
|
693
|
+
{
|
|
694
|
+
var _t13 = {
|
|
695
|
+
key: n,
|
|
696
|
+
data: _r6
|
|
697
|
+
};
|
|
698
|
+
e.push(_t13), a += _h5, o = s[a], "M" === n && (n = "L"), "m" === n && (n = "l");
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
return e;
|
|
702
|
+
}
|
|
703
|
+
function d(t) {
|
|
704
|
+
var _r8, _r9, _r10;
|
|
705
|
+
var e = 0,
|
|
706
|
+
s = 0,
|
|
707
|
+
n = 0,
|
|
708
|
+
a = 0;
|
|
709
|
+
var o = [];
|
|
710
|
+
var _iterator7 = _createForOfIteratorHelper(t),
|
|
711
|
+
_step7;
|
|
712
|
+
try {
|
|
713
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
714
|
+
var _step7$value = _step7.value,
|
|
715
|
+
_h6 = _step7$value.key,
|
|
716
|
+
_r7 = _step7$value.data;
|
|
717
|
+
switch (_h6) {
|
|
718
|
+
case "M":
|
|
719
|
+
o.push({
|
|
720
|
+
key: "M",
|
|
721
|
+
data: _toConsumableArray(_r7)
|
|
722
|
+
}), (_r8 = _slicedToArray(_r7, 2), e = _r8[0], s = _r8[1]), (_r9 = _slicedToArray(_r7, 2), n = _r9[0], a = _r9[1]);
|
|
723
|
+
break;
|
|
724
|
+
case "m":
|
|
725
|
+
e += _r7[0], s += _r7[1], o.push({
|
|
726
|
+
key: "M",
|
|
727
|
+
data: [e, s]
|
|
728
|
+
}), n = e, a = s;
|
|
729
|
+
break;
|
|
730
|
+
case "L":
|
|
731
|
+
o.push({
|
|
732
|
+
key: "L",
|
|
733
|
+
data: _toConsumableArray(_r7)
|
|
734
|
+
}), (_r10 = _slicedToArray(_r7, 2), e = _r10[0], s = _r10[1]);
|
|
735
|
+
break;
|
|
736
|
+
case "l":
|
|
737
|
+
e += _r7[0], s += _r7[1], o.push({
|
|
738
|
+
key: "L",
|
|
739
|
+
data: [e, s]
|
|
740
|
+
});
|
|
741
|
+
break;
|
|
742
|
+
case "C":
|
|
743
|
+
o.push({
|
|
744
|
+
key: "C",
|
|
745
|
+
data: _toConsumableArray(_r7)
|
|
746
|
+
}), e = _r7[4], s = _r7[5];
|
|
747
|
+
break;
|
|
748
|
+
case "c":
|
|
749
|
+
{
|
|
750
|
+
var _t14 = _r7.map(function (t, n) {
|
|
751
|
+
return n % 2 ? t + s : t + e;
|
|
752
|
+
});
|
|
753
|
+
o.push({
|
|
754
|
+
key: "C",
|
|
755
|
+
data: _t14
|
|
756
|
+
}), e = _t14[4], s = _t14[5];
|
|
757
|
+
break;
|
|
758
|
+
}
|
|
759
|
+
case "Q":
|
|
760
|
+
o.push({
|
|
761
|
+
key: "Q",
|
|
762
|
+
data: _toConsumableArray(_r7)
|
|
763
|
+
}), e = _r7[2], s = _r7[3];
|
|
764
|
+
break;
|
|
765
|
+
case "q":
|
|
766
|
+
{
|
|
767
|
+
var _t15 = _r7.map(function (t, n) {
|
|
768
|
+
return n % 2 ? t + s : t + e;
|
|
769
|
+
});
|
|
770
|
+
o.push({
|
|
771
|
+
key: "Q",
|
|
772
|
+
data: _t15
|
|
773
|
+
}), e = _t15[2], s = _t15[3];
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
case "A":
|
|
777
|
+
o.push({
|
|
778
|
+
key: "A",
|
|
779
|
+
data: _toConsumableArray(_r7)
|
|
780
|
+
}), e = _r7[5], s = _r7[6];
|
|
781
|
+
break;
|
|
782
|
+
case "a":
|
|
783
|
+
e += _r7[5], s += _r7[6], o.push({
|
|
784
|
+
key: "A",
|
|
785
|
+
data: [_r7[0], _r7[1], _r7[2], _r7[3], _r7[4], e, s]
|
|
786
|
+
});
|
|
787
|
+
break;
|
|
788
|
+
case "H":
|
|
789
|
+
o.push({
|
|
790
|
+
key: "H",
|
|
791
|
+
data: _toConsumableArray(_r7)
|
|
792
|
+
}), e = _r7[0];
|
|
793
|
+
break;
|
|
794
|
+
case "h":
|
|
795
|
+
e += _r7[0], o.push({
|
|
796
|
+
key: "H",
|
|
797
|
+
data: [e]
|
|
798
|
+
});
|
|
799
|
+
break;
|
|
800
|
+
case "V":
|
|
801
|
+
o.push({
|
|
802
|
+
key: "V",
|
|
803
|
+
data: _toConsumableArray(_r7)
|
|
804
|
+
}), s = _r7[0];
|
|
805
|
+
break;
|
|
806
|
+
case "v":
|
|
807
|
+
s += _r7[0], o.push({
|
|
808
|
+
key: "V",
|
|
809
|
+
data: [s]
|
|
810
|
+
});
|
|
811
|
+
break;
|
|
812
|
+
case "S":
|
|
813
|
+
o.push({
|
|
814
|
+
key: "S",
|
|
815
|
+
data: _toConsumableArray(_r7)
|
|
816
|
+
}), e = _r7[2], s = _r7[3];
|
|
817
|
+
break;
|
|
818
|
+
case "s":
|
|
819
|
+
{
|
|
820
|
+
var _t16 = _r7.map(function (t, n) {
|
|
821
|
+
return n % 2 ? t + s : t + e;
|
|
822
|
+
});
|
|
823
|
+
o.push({
|
|
824
|
+
key: "S",
|
|
825
|
+
data: _t16
|
|
826
|
+
}), e = _t16[2], s = _t16[3];
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
case "T":
|
|
830
|
+
o.push({
|
|
831
|
+
key: "T",
|
|
832
|
+
data: _toConsumableArray(_r7)
|
|
833
|
+
}), e = _r7[0], s = _r7[1];
|
|
834
|
+
break;
|
|
835
|
+
case "t":
|
|
836
|
+
e += _r7[0], s += _r7[1], o.push({
|
|
837
|
+
key: "T",
|
|
838
|
+
data: [e, s]
|
|
839
|
+
});
|
|
840
|
+
break;
|
|
841
|
+
case "Z":
|
|
842
|
+
case "z":
|
|
843
|
+
o.push({
|
|
844
|
+
key: "Z",
|
|
845
|
+
data: []
|
|
846
|
+
}), e = n, s = a;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
} catch (err) {
|
|
850
|
+
_iterator7.e(err);
|
|
851
|
+
} finally {
|
|
852
|
+
_iterator7.f();
|
|
853
|
+
}
|
|
854
|
+
return o;
|
|
855
|
+
}
|
|
856
|
+
function g(t) {
|
|
857
|
+
var _l5, _l6, _l7;
|
|
858
|
+
var e = [];
|
|
859
|
+
var s = "",
|
|
860
|
+
n = 0,
|
|
861
|
+
a = 0,
|
|
862
|
+
o = 0,
|
|
863
|
+
h = 0,
|
|
864
|
+
r = 0,
|
|
865
|
+
i = 0;
|
|
866
|
+
var _iterator8 = _createForOfIteratorHelper(t),
|
|
867
|
+
_step8;
|
|
868
|
+
try {
|
|
869
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
870
|
+
var _step8$value = _step8.value,
|
|
871
|
+
_c3 = _step8$value.key,
|
|
872
|
+
_l4 = _step8$value.data;
|
|
873
|
+
switch (_c3) {
|
|
874
|
+
case "M":
|
|
875
|
+
e.push({
|
|
876
|
+
key: "M",
|
|
877
|
+
data: _toConsumableArray(_l4)
|
|
878
|
+
}), (_l5 = _slicedToArray(_l4, 2), n = _l5[0], a = _l5[1]), (_l6 = _slicedToArray(_l4, 2), o = _l6[0], h = _l6[1]);
|
|
879
|
+
break;
|
|
880
|
+
case "C":
|
|
881
|
+
e.push({
|
|
882
|
+
key: "C",
|
|
883
|
+
data: _toConsumableArray(_l4)
|
|
884
|
+
}), n = _l4[4], a = _l4[5], r = _l4[2], i = _l4[3];
|
|
885
|
+
break;
|
|
886
|
+
case "L":
|
|
887
|
+
e.push({
|
|
888
|
+
key: "L",
|
|
889
|
+
data: _toConsumableArray(_l4)
|
|
890
|
+
}), (_l7 = _slicedToArray(_l4, 2), n = _l7[0], a = _l7[1]);
|
|
891
|
+
break;
|
|
892
|
+
case "H":
|
|
893
|
+
n = _l4[0], e.push({
|
|
894
|
+
key: "L",
|
|
895
|
+
data: [n, a]
|
|
896
|
+
});
|
|
897
|
+
break;
|
|
898
|
+
case "V":
|
|
899
|
+
a = _l4[0], e.push({
|
|
900
|
+
key: "L",
|
|
901
|
+
data: [n, a]
|
|
902
|
+
});
|
|
903
|
+
break;
|
|
904
|
+
case "S":
|
|
905
|
+
{
|
|
906
|
+
var _t17 = 0,
|
|
907
|
+
_o3 = 0;
|
|
908
|
+
"C" === s || "S" === s ? (_t17 = n + (n - r), _o3 = a + (a - i)) : (_t17 = n, _o3 = a), e.push({
|
|
909
|
+
key: "C",
|
|
910
|
+
data: [_t17, _o3].concat(_toConsumableArray(_l4))
|
|
911
|
+
}), r = _l4[0], i = _l4[1], n = _l4[2], a = _l4[3];
|
|
912
|
+
break;
|
|
913
|
+
}
|
|
914
|
+
case "T":
|
|
915
|
+
{
|
|
916
|
+
var _l8 = _slicedToArray(_l4, 2),
|
|
917
|
+
_t18 = _l8[0],
|
|
918
|
+
_o4 = _l8[1];
|
|
919
|
+
var _h7 = 0,
|
|
920
|
+
_c4 = 0;
|
|
921
|
+
"Q" === s || "T" === s ? (_h7 = n + (n - r), _c4 = a + (a - i)) : (_h7 = n, _c4 = a);
|
|
922
|
+
var _u3 = n + 2 * (_h7 - n) / 3,
|
|
923
|
+
_p2 = a + 2 * (_c4 - a) / 3,
|
|
924
|
+
_f = _t18 + 2 * (_h7 - _t18) / 3,
|
|
925
|
+
_d = _o4 + 2 * (_c4 - _o4) / 3;
|
|
926
|
+
e.push({
|
|
927
|
+
key: "C",
|
|
928
|
+
data: [_u3, _p2, _f, _d, _t18, _o4]
|
|
929
|
+
}), r = _h7, i = _c4, n = _t18, a = _o4;
|
|
930
|
+
break;
|
|
931
|
+
}
|
|
932
|
+
case "Q":
|
|
933
|
+
{
|
|
934
|
+
var _l9 = _slicedToArray(_l4, 4),
|
|
935
|
+
_t19 = _l9[0],
|
|
936
|
+
_s7 = _l9[1],
|
|
937
|
+
_o5 = _l9[2],
|
|
938
|
+
_h8 = _l9[3],
|
|
939
|
+
_c5 = n + 2 * (_t19 - n) / 3,
|
|
940
|
+
_u4 = a + 2 * (_s7 - a) / 3,
|
|
941
|
+
_p3 = _o5 + 2 * (_t19 - _o5) / 3,
|
|
942
|
+
_f2 = _h8 + 2 * (_s7 - _h8) / 3;
|
|
943
|
+
e.push({
|
|
944
|
+
key: "C",
|
|
945
|
+
data: [_c5, _u4, _p3, _f2, _o5, _h8]
|
|
946
|
+
}), r = _t19, i = _s7, n = _o5, a = _h8;
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
949
|
+
case "A":
|
|
950
|
+
{
|
|
951
|
+
var _t20 = Math.abs(_l4[0]),
|
|
952
|
+
_s8 = Math.abs(_l4[1]),
|
|
953
|
+
_o6 = _l4[2],
|
|
954
|
+
_h9 = _l4[3],
|
|
955
|
+
_r11 = _l4[4],
|
|
956
|
+
_i6 = _l4[5],
|
|
957
|
+
_c6 = _l4[6];
|
|
958
|
+
if (0 === _t20 || 0 === _s8) e.push({
|
|
959
|
+
key: "C",
|
|
960
|
+
data: [n, a, _i6, _c6, _i6, _c6]
|
|
961
|
+
}), n = _i6, a = _c6;else if (n !== _i6 || a !== _c6) {
|
|
962
|
+
k(n, a, _i6, _c6, _t20, _s8, _o6, _h9, _r11).forEach(function (t) {
|
|
963
|
+
e.push({
|
|
964
|
+
key: "C",
|
|
965
|
+
data: t
|
|
966
|
+
});
|
|
967
|
+
}), n = _i6, a = _c6;
|
|
968
|
+
}
|
|
969
|
+
break;
|
|
970
|
+
}
|
|
971
|
+
case "Z":
|
|
972
|
+
e.push({
|
|
973
|
+
key: "Z",
|
|
974
|
+
data: []
|
|
975
|
+
}), n = o, a = h;
|
|
976
|
+
}
|
|
977
|
+
s = _c3;
|
|
978
|
+
}
|
|
979
|
+
} catch (err) {
|
|
980
|
+
_iterator8.e(err);
|
|
981
|
+
} finally {
|
|
982
|
+
_iterator8.f();
|
|
983
|
+
}
|
|
984
|
+
return e;
|
|
985
|
+
}
|
|
986
|
+
function M(t, e, s) {
|
|
987
|
+
return [t * Math.cos(s) - e * Math.sin(s), t * Math.sin(s) + e * Math.cos(s)];
|
|
988
|
+
}
|
|
989
|
+
function k(t, e, s, n, a, o, h, r, i, c) {
|
|
990
|
+
var l = (u = h, Math.PI * u / 180);
|
|
991
|
+
var u;
|
|
992
|
+
var p = [],
|
|
993
|
+
f = 0,
|
|
994
|
+
d = 0,
|
|
995
|
+
g = 0,
|
|
996
|
+
b = 0;
|
|
997
|
+
if (c) {
|
|
998
|
+
var _c7 = _slicedToArray(c, 4);
|
|
999
|
+
f = _c7[0];
|
|
1000
|
+
d = _c7[1];
|
|
1001
|
+
g = _c7[2];
|
|
1002
|
+
b = _c7[3];
|
|
1003
|
+
} else {
|
|
1004
|
+
var _M, _M2, _M3, _M4;
|
|
1005
|
+
(_M = M(t, e, -l), _M2 = _slicedToArray(_M, 2), t = _M2[0], e = _M2[1]), (_M3 = M(s, n, -l), _M4 = _slicedToArray(_M3, 2), s = _M4[0], n = _M4[1]);
|
|
1006
|
+
var _h10 = (t - s) / 2,
|
|
1007
|
+
_c8 = (e - n) / 2;
|
|
1008
|
+
var _u5 = _h10 * _h10 / (a * a) + _c8 * _c8 / (o * o);
|
|
1009
|
+
_u5 > 1 && (_u5 = Math.sqrt(_u5), a *= _u5, o *= _u5);
|
|
1010
|
+
var _p4 = a * a,
|
|
1011
|
+
_k = o * o,
|
|
1012
|
+
_y = _p4 * _k - _p4 * _c8 * _c8 - _k * _h10 * _h10,
|
|
1013
|
+
_m = _p4 * _c8 * _c8 + _k * _h10 * _h10,
|
|
1014
|
+
_w = (r === i ? -1 : 1) * Math.sqrt(Math.abs(_y / _m));
|
|
1015
|
+
g = _w * a * _c8 / o + (t + s) / 2, b = _w * -o * _h10 / a + (e + n) / 2, f = Math.asin(parseFloat(((e - b) / o).toFixed(9))), d = Math.asin(parseFloat(((n - b) / o).toFixed(9))), t < g && (f = Math.PI - f), s < g && (d = Math.PI - d), f < 0 && (f = 2 * Math.PI + f), d < 0 && (d = 2 * Math.PI + d), i && f > d && (f -= 2 * Math.PI), !i && d > f && (d -= 2 * Math.PI);
|
|
1016
|
+
}
|
|
1017
|
+
var y = d - f;
|
|
1018
|
+
if (Math.abs(y) > 120 * Math.PI / 180) {
|
|
1019
|
+
var _t21 = d,
|
|
1020
|
+
_e10 = s,
|
|
1021
|
+
_r12 = n;
|
|
1022
|
+
d = i && d > f ? f + 120 * Math.PI / 180 * 1 : f + 120 * Math.PI / 180 * -1, p = k(s = g + a * Math.cos(d), n = b + o * Math.sin(d), _e10, _r12, a, o, h, 0, i, [d, _t21, g, b]);
|
|
1023
|
+
}
|
|
1024
|
+
y = d - f;
|
|
1025
|
+
var m = Math.cos(f),
|
|
1026
|
+
w = Math.sin(f),
|
|
1027
|
+
x = Math.cos(d),
|
|
1028
|
+
P = Math.sin(d),
|
|
1029
|
+
v = Math.tan(y / 4),
|
|
1030
|
+
O = 4 / 3 * a * v,
|
|
1031
|
+
S = 4 / 3 * o * v,
|
|
1032
|
+
L = [t, e],
|
|
1033
|
+
T = [t + O * w, e - S * m],
|
|
1034
|
+
D = [s + O * P, n - S * x],
|
|
1035
|
+
A = [s, n];
|
|
1036
|
+
if (T[0] = 2 * L[0] - T[0], T[1] = 2 * L[1] - T[1], c) return [T, D, A].concat(p);
|
|
1037
|
+
{
|
|
1038
|
+
p = [T, D, A].concat(p);
|
|
1039
|
+
var _t22 = [];
|
|
1040
|
+
for (var _e11 = 0; _e11 < p.length; _e11 += 3) {
|
|
1041
|
+
var _s9 = M(p[_e11][0], p[_e11][1], l),
|
|
1042
|
+
_n7 = M(p[_e11 + 1][0], p[_e11 + 1][1], l),
|
|
1043
|
+
_a4 = M(p[_e11 + 2][0], p[_e11 + 2][1], l);
|
|
1044
|
+
_t22.push([_s9[0], _s9[1], _n7[0], _n7[1], _a4[0], _a4[1]]);
|
|
1045
|
+
}
|
|
1046
|
+
return _t22;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
var b = {
|
|
1050
|
+
randOffset: function randOffset(t, e) {
|
|
1051
|
+
return A(t, e);
|
|
1052
|
+
},
|
|
1053
|
+
randOffsetWithRange: function randOffsetWithRange(t, e, s) {
|
|
1054
|
+
return D(t, e, s);
|
|
1055
|
+
},
|
|
1056
|
+
ellipse: function ellipse(t, e, s, n, a) {
|
|
1057
|
+
var o = P(s, n, a);
|
|
1058
|
+
return v(t, e, a, o).opset;
|
|
1059
|
+
},
|
|
1060
|
+
doubleLineOps: function doubleLineOps(t, e, s, n, a) {
|
|
1061
|
+
return I(t, e, s, n, a, !0);
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
function y(t, e, s, n, a) {
|
|
1065
|
+
return {
|
|
1066
|
+
type: "path",
|
|
1067
|
+
ops: I(t, e, s, n, a)
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
function m(t, e, s) {
|
|
1071
|
+
var n = (t || []).length;
|
|
1072
|
+
if (n > 2) {
|
|
1073
|
+
var _a5 = [];
|
|
1074
|
+
for (var _e12 = 0; _e12 < n - 1; _e12++) _a5.push.apply(_a5, _toConsumableArray(I(t[_e12][0], t[_e12][1], t[_e12 + 1][0], t[_e12 + 1][1], s)));
|
|
1075
|
+
return e && _a5.push.apply(_a5, _toConsumableArray(I(t[n - 1][0], t[n - 1][1], t[0][0], t[0][1], s))), {
|
|
1076
|
+
type: "path",
|
|
1077
|
+
ops: _a5
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
return 2 === n ? y(t[0][0], t[0][1], t[1][0], t[1][1], s) : {
|
|
1081
|
+
type: "path",
|
|
1082
|
+
ops: []
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
function w(t, e, s, n, a) {
|
|
1086
|
+
return function (t, e) {
|
|
1087
|
+
return m(t, !0, e);
|
|
1088
|
+
}([[t, e], [t + s, e], [t + s, e + n], [t, e + n]], a);
|
|
1089
|
+
}
|
|
1090
|
+
function x(t, e) {
|
|
1091
|
+
var s = _(t, 1 * (1 + .2 * e.roughness), e);
|
|
1092
|
+
if (!e.disableMultiStroke) {
|
|
1093
|
+
var _n8 = _(t, 1.5 * (1 + .22 * e.roughness), function (t) {
|
|
1094
|
+
var e = Object.assign({}, t);
|
|
1095
|
+
e.randomizer = void 0, t.seed && (e.seed = t.seed + 1);
|
|
1096
|
+
return e;
|
|
1097
|
+
}(e));
|
|
1098
|
+
s = s.concat(_n8);
|
|
1099
|
+
}
|
|
1100
|
+
return {
|
|
1101
|
+
type: "path",
|
|
1102
|
+
ops: s
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
function P(t, e, s) {
|
|
1106
|
+
var n = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(t / 2, 2) + Math.pow(e / 2, 2)) / 2)),
|
|
1107
|
+
a = Math.ceil(Math.max(s.curveStepCount, s.curveStepCount / Math.sqrt(200) * n)),
|
|
1108
|
+
o = 2 * Math.PI / a;
|
|
1109
|
+
var h = Math.abs(t / 2),
|
|
1110
|
+
r = Math.abs(e / 2);
|
|
1111
|
+
var i = 1 - s.curveFitting;
|
|
1112
|
+
return h += A(h * i, s), r += A(r * i, s), {
|
|
1113
|
+
increment: o,
|
|
1114
|
+
rx: h,
|
|
1115
|
+
ry: r
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
function v(t, e, s, n) {
|
|
1119
|
+
var _z = z(n.increment, t, e, n.rx, n.ry, 1, n.increment * D(.1, D(.4, 1, s), s), s),
|
|
1120
|
+
_z2 = _slicedToArray(_z, 2),
|
|
1121
|
+
a = _z2[0],
|
|
1122
|
+
o = _z2[1];
|
|
1123
|
+
var h = W(a, null, s);
|
|
1124
|
+
if (!s.disableMultiStroke && 0 !== s.roughness) {
|
|
1125
|
+
var _z3 = z(n.increment, t, e, n.rx, n.ry, 1.5, 0, s),
|
|
1126
|
+
_z4 = _slicedToArray(_z3, 1),
|
|
1127
|
+
_a6 = _z4[0],
|
|
1128
|
+
_o7 = W(_a6, null, s);
|
|
1129
|
+
h = h.concat(_o7);
|
|
1130
|
+
}
|
|
1131
|
+
return {
|
|
1132
|
+
estimatedPoints: o,
|
|
1133
|
+
opset: {
|
|
1134
|
+
type: "path",
|
|
1135
|
+
ops: h
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
function O(t, e, s, n, a, o, h, r, i) {
|
|
1140
|
+
var c = t,
|
|
1141
|
+
l = e;
|
|
1142
|
+
var u = Math.abs(s / 2),
|
|
1143
|
+
p = Math.abs(n / 2);
|
|
1144
|
+
u += A(.01 * u, i), p += A(.01 * p, i);
|
|
1145
|
+
var f = a,
|
|
1146
|
+
d = o;
|
|
1147
|
+
for (; f < 0;) f += 2 * Math.PI, d += 2 * Math.PI;
|
|
1148
|
+
d - f > 2 * Math.PI && (f = 0, d = 2 * Math.PI);
|
|
1149
|
+
var g = 2 * Math.PI / i.curveStepCount,
|
|
1150
|
+
M = Math.min(g / 2, (d - f) / 2),
|
|
1151
|
+
k = E(M, c, l, u, p, f, d, 1, i);
|
|
1152
|
+
if (!i.disableMultiStroke) {
|
|
1153
|
+
var _t23 = E(M, c, l, u, p, f, d, 1.5, i);
|
|
1154
|
+
k.push.apply(k, _toConsumableArray(_t23));
|
|
1155
|
+
}
|
|
1156
|
+
return h && (r ? k.push.apply(k, _toConsumableArray(I(c, l, c + u * Math.cos(f), l + p * Math.sin(f), i)).concat(_toConsumableArray(I(c, l, c + u * Math.cos(d), l + p * Math.sin(d), i)))) : k.push({
|
|
1157
|
+
op: "lineTo",
|
|
1158
|
+
data: [c, l]
|
|
1159
|
+
}, {
|
|
1160
|
+
op: "lineTo",
|
|
1161
|
+
data: [c + u * Math.cos(f), l + p * Math.sin(f)]
|
|
1162
|
+
})), {
|
|
1163
|
+
type: "path",
|
|
1164
|
+
ops: k
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
function S(t, e) {
|
|
1168
|
+
var s = [];
|
|
1169
|
+
var _iterator9 = _createForOfIteratorHelper(t),
|
|
1170
|
+
_step9;
|
|
1171
|
+
try {
|
|
1172
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
1173
|
+
var _n9 = _step9.value;
|
|
1174
|
+
if (_n9.length) {
|
|
1175
|
+
var _t24 = e.maxRandomnessOffset || 0,
|
|
1176
|
+
_a7 = _n9.length;
|
|
1177
|
+
if (_a7 > 2) {
|
|
1178
|
+
s.push({
|
|
1179
|
+
op: "move",
|
|
1180
|
+
data: [_n9[0][0] + A(_t24, e), _n9[0][1] + A(_t24, e)]
|
|
1181
|
+
});
|
|
1182
|
+
for (var _o8 = 1; _o8 < _a7; _o8++) s.push({
|
|
1183
|
+
op: "lineTo",
|
|
1184
|
+
data: [_n9[_o8][0] + A(_t24, e), _n9[_o8][1] + A(_t24, e)]
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
} catch (err) {
|
|
1190
|
+
_iterator9.e(err);
|
|
1191
|
+
} finally {
|
|
1192
|
+
_iterator9.f();
|
|
1193
|
+
}
|
|
1194
|
+
return {
|
|
1195
|
+
type: "fillPath",
|
|
1196
|
+
ops: s
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
function L(t, e) {
|
|
1200
|
+
return function (t, e) {
|
|
1201
|
+
var s = t.fillStyle || "hachure";
|
|
1202
|
+
if (!c[s]) switch (s) {
|
|
1203
|
+
case "zigzag":
|
|
1204
|
+
c[s] || (c[s] = new a(e));
|
|
1205
|
+
break;
|
|
1206
|
+
case "cross-hatch":
|
|
1207
|
+
c[s] || (c[s] = new o(e));
|
|
1208
|
+
break;
|
|
1209
|
+
case "dots":
|
|
1210
|
+
c[s] || (c[s] = new h(e));
|
|
1211
|
+
break;
|
|
1212
|
+
case "dashed":
|
|
1213
|
+
c[s] || (c[s] = new r(e));
|
|
1214
|
+
break;
|
|
1215
|
+
case "zigzag-line":
|
|
1216
|
+
c[s] || (c[s] = new i(e));
|
|
1217
|
+
break;
|
|
1218
|
+
case "hachure":
|
|
1219
|
+
default:
|
|
1220
|
+
s = "hachure", c[s] || (c[s] = new n(e));
|
|
1221
|
+
}
|
|
1222
|
+
return c[s];
|
|
1223
|
+
}(e, b).fillPolygons(t, e);
|
|
1224
|
+
}
|
|
1225
|
+
function T(t) {
|
|
1226
|
+
return t.randomizer || (t.randomizer = new l(t.seed || 0)), t.randomizer.next();
|
|
1227
|
+
}
|
|
1228
|
+
function D(t, e, s) {
|
|
1229
|
+
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
1230
|
+
return s.roughness * n * (T(s) * (e - t) + t);
|
|
1231
|
+
}
|
|
1232
|
+
function A(t, e) {
|
|
1233
|
+
var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1234
|
+
return D(-t, t, e, s);
|
|
1235
|
+
}
|
|
1236
|
+
function I(t, e, s, n, a) {
|
|
1237
|
+
var o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;
|
|
1238
|
+
var h = o ? a.disableMultiStrokeFill : a.disableMultiStroke,
|
|
1239
|
+
r = C(t, e, s, n, a, !0, !1);
|
|
1240
|
+
if (h) return r;
|
|
1241
|
+
var i = C(t, e, s, n, a, !0, !0);
|
|
1242
|
+
return r.concat(i);
|
|
1243
|
+
}
|
|
1244
|
+
function C(t, e, s, n, a, o, h) {
|
|
1245
|
+
var r = Math.pow(t - s, 2) + Math.pow(e - n, 2),
|
|
1246
|
+
i = Math.sqrt(r);
|
|
1247
|
+
var c = 1;
|
|
1248
|
+
c = i < 200 ? 1 : i > 500 ? .4 : -.0016668 * i + 1.233334;
|
|
1249
|
+
var l = a.maxRandomnessOffset || 0;
|
|
1250
|
+
l * l * 100 > r && (l = i / 10);
|
|
1251
|
+
var u = l / 2,
|
|
1252
|
+
p = .2 + .2 * T(a);
|
|
1253
|
+
var f = a.bowing * a.maxRandomnessOffset * (n - e) / 200,
|
|
1254
|
+
d = a.bowing * a.maxRandomnessOffset * (t - s) / 200;
|
|
1255
|
+
f = A(f, a, c), d = A(d, a, c);
|
|
1256
|
+
var g = [],
|
|
1257
|
+
M = function M() {
|
|
1258
|
+
return A(u, a, c);
|
|
1259
|
+
},
|
|
1260
|
+
k = function k() {
|
|
1261
|
+
return A(l, a, c);
|
|
1262
|
+
},
|
|
1263
|
+
b = a.preserveVertices;
|
|
1264
|
+
return o && (h ? g.push({
|
|
1265
|
+
op: "move",
|
|
1266
|
+
data: [t + (b ? 0 : M()), e + (b ? 0 : M())]
|
|
1267
|
+
}) : g.push({
|
|
1268
|
+
op: "move",
|
|
1269
|
+
data: [t + (b ? 0 : A(l, a, c)), e + (b ? 0 : A(l, a, c))]
|
|
1270
|
+
})), h ? g.push({
|
|
1271
|
+
op: "bcurveTo",
|
|
1272
|
+
data: [f + t + (s - t) * p + M(), d + e + (n - e) * p + M(), f + t + 2 * (s - t) * p + M(), d + e + 2 * (n - e) * p + M(), s + (b ? 0 : M()), n + (b ? 0 : M())]
|
|
1273
|
+
}) : g.push({
|
|
1274
|
+
op: "bcurveTo",
|
|
1275
|
+
data: [f + t + (s - t) * p + k(), d + e + (n - e) * p + k(), f + t + 2 * (s - t) * p + k(), d + e + 2 * (n - e) * p + k(), s + (b ? 0 : k()), n + (b ? 0 : k())]
|
|
1276
|
+
}), g;
|
|
1277
|
+
}
|
|
1278
|
+
function _(t, e, s) {
|
|
1279
|
+
var n = [];
|
|
1280
|
+
n.push([t[0][0] + A(e, s), t[0][1] + A(e, s)]), n.push([t[0][0] + A(e, s), t[0][1] + A(e, s)]);
|
|
1281
|
+
for (var _a8 = 1; _a8 < t.length; _a8++) n.push([t[_a8][0] + A(e, s), t[_a8][1] + A(e, s)]), _a8 === t.length - 1 && n.push([t[_a8][0] + A(e, s), t[_a8][1] + A(e, s)]);
|
|
1282
|
+
return W(n, null, s);
|
|
1283
|
+
}
|
|
1284
|
+
function W(t, e, s) {
|
|
1285
|
+
var n = t.length,
|
|
1286
|
+
a = [];
|
|
1287
|
+
if (n > 3) {
|
|
1288
|
+
var _o9 = [],
|
|
1289
|
+
_h11 = 1 - s.curveTightness;
|
|
1290
|
+
a.push({
|
|
1291
|
+
op: "move",
|
|
1292
|
+
data: [t[1][0], t[1][1]]
|
|
1293
|
+
});
|
|
1294
|
+
for (var _e13 = 1; _e13 + 2 < n; _e13++) {
|
|
1295
|
+
var _s10 = t[_e13];
|
|
1296
|
+
_o9[0] = [_s10[0], _s10[1]], _o9[1] = [_s10[0] + (_h11 * t[_e13 + 1][0] - _h11 * t[_e13 - 1][0]) / 6, _s10[1] + (_h11 * t[_e13 + 1][1] - _h11 * t[_e13 - 1][1]) / 6], _o9[2] = [t[_e13 + 1][0] + (_h11 * t[_e13][0] - _h11 * t[_e13 + 2][0]) / 6, t[_e13 + 1][1] + (_h11 * t[_e13][1] - _h11 * t[_e13 + 2][1]) / 6], _o9[3] = [t[_e13 + 1][0], t[_e13 + 1][1]], a.push({
|
|
1297
|
+
op: "bcurveTo",
|
|
1298
|
+
data: [_o9[1][0], _o9[1][1], _o9[2][0], _o9[2][1], _o9[3][0], _o9[3][1]]
|
|
1299
|
+
});
|
|
1300
|
+
}
|
|
1301
|
+
if (e && 2 === e.length) {
|
|
1302
|
+
var _t25 = s.maxRandomnessOffset;
|
|
1303
|
+
a.push({
|
|
1304
|
+
op: "lineTo",
|
|
1305
|
+
data: [e[0] + A(_t25, s), e[1] + A(_t25, s)]
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
} else 3 === n ? (a.push({
|
|
1309
|
+
op: "move",
|
|
1310
|
+
data: [t[1][0], t[1][1]]
|
|
1311
|
+
}), a.push({
|
|
1312
|
+
op: "bcurveTo",
|
|
1313
|
+
data: [t[1][0], t[1][1], t[2][0], t[2][1], t[2][0], t[2][1]]
|
|
1314
|
+
})) : 2 === n && a.push.apply(a, _toConsumableArray(I(t[0][0], t[0][1], t[1][0], t[1][1], s)));
|
|
1315
|
+
return a;
|
|
1316
|
+
}
|
|
1317
|
+
function z(t, e, s, n, a, o, h, r) {
|
|
1318
|
+
var i = [],
|
|
1319
|
+
c = [];
|
|
1320
|
+
if (0 === r.roughness) {
|
|
1321
|
+
t /= 4, c.push([e + n * Math.cos(-t), s + a * Math.sin(-t)]);
|
|
1322
|
+
for (var _o10 = 0; _o10 <= 2 * Math.PI; _o10 += t) {
|
|
1323
|
+
var _t26 = [e + n * Math.cos(_o10), s + a * Math.sin(_o10)];
|
|
1324
|
+
i.push(_t26), c.push(_t26);
|
|
1325
|
+
}
|
|
1326
|
+
c.push([e + n * Math.cos(0), s + a * Math.sin(0)]), c.push([e + n * Math.cos(t), s + a * Math.sin(t)]);
|
|
1327
|
+
} else {
|
|
1328
|
+
var _l10 = A(.5, r) - Math.PI / 2;
|
|
1329
|
+
c.push([A(o, r) + e + .9 * n * Math.cos(_l10 - t), A(o, r) + s + .9 * a * Math.sin(_l10 - t)]);
|
|
1330
|
+
var _u6 = 2 * Math.PI + _l10 - .01;
|
|
1331
|
+
for (var _h12 = _l10; _h12 < _u6; _h12 += t) {
|
|
1332
|
+
var _t27 = [A(o, r) + e + n * Math.cos(_h12), A(o, r) + s + a * Math.sin(_h12)];
|
|
1333
|
+
i.push(_t27), c.push(_t27);
|
|
1334
|
+
}
|
|
1335
|
+
c.push([A(o, r) + e + n * Math.cos(_l10 + 2 * Math.PI + .5 * h), A(o, r) + s + a * Math.sin(_l10 + 2 * Math.PI + .5 * h)]), c.push([A(o, r) + e + .98 * n * Math.cos(_l10 + h), A(o, r) + s + .98 * a * Math.sin(_l10 + h)]), c.push([A(o, r) + e + .9 * n * Math.cos(_l10 + .5 * h), A(o, r) + s + .9 * a * Math.sin(_l10 + .5 * h)]);
|
|
1336
|
+
}
|
|
1337
|
+
return [c, i];
|
|
1338
|
+
}
|
|
1339
|
+
function E(t, e, s, n, a, o, h, r, i) {
|
|
1340
|
+
var c = o + A(.1, i),
|
|
1341
|
+
l = [];
|
|
1342
|
+
l.push([A(r, i) + e + .9 * n * Math.cos(c - t), A(r, i) + s + .9 * a * Math.sin(c - t)]);
|
|
1343
|
+
for (var _o11 = c; _o11 <= h; _o11 += t) l.push([A(r, i) + e + n * Math.cos(_o11), A(r, i) + s + a * Math.sin(_o11)]);
|
|
1344
|
+
return l.push([e + n * Math.cos(h), s + a * Math.sin(h)]), l.push([e + n * Math.cos(h), s + a * Math.sin(h)]), W(l, null, i);
|
|
1345
|
+
}
|
|
1346
|
+
function $(t, e, s, n, a, o, h, r) {
|
|
1347
|
+
var i = [],
|
|
1348
|
+
c = [r.maxRandomnessOffset || 1, (r.maxRandomnessOffset || 1) + .3];
|
|
1349
|
+
var l = [0, 0];
|
|
1350
|
+
var u = r.disableMultiStroke ? 1 : 2,
|
|
1351
|
+
p = r.preserveVertices;
|
|
1352
|
+
for (var _f3 = 0; _f3 < u; _f3++) 0 === _f3 ? i.push({
|
|
1353
|
+
op: "move",
|
|
1354
|
+
data: [h[0], h[1]]
|
|
1355
|
+
}) : i.push({
|
|
1356
|
+
op: "move",
|
|
1357
|
+
data: [h[0] + (p ? 0 : A(c[0], r)), h[1] + (p ? 0 : A(c[0], r))]
|
|
1358
|
+
}), l = p ? [a, o] : [a + A(c[_f3], r), o + A(c[_f3], r)], i.push({
|
|
1359
|
+
op: "bcurveTo",
|
|
1360
|
+
data: [t + A(c[_f3], r), e + A(c[_f3], r), s + A(c[_f3], r), n + A(c[_f3], r), l[0], l[1]]
|
|
1361
|
+
});
|
|
1362
|
+
return i;
|
|
1363
|
+
}
|
|
1364
|
+
function G(t) {
|
|
1365
|
+
return _toConsumableArray(t);
|
|
1366
|
+
}
|
|
1367
|
+
function R(t, e) {
|
|
1368
|
+
return Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2);
|
|
1369
|
+
}
|
|
1370
|
+
function q(t, e, s) {
|
|
1371
|
+
var n = R(e, s);
|
|
1372
|
+
if (0 === n) return R(t, e);
|
|
1373
|
+
var a = ((t[0] - e[0]) * (s[0] - e[0]) + (t[1] - e[1]) * (s[1] - e[1])) / n;
|
|
1374
|
+
return a = Math.max(0, Math.min(1, a)), R(t, j(e, s, a));
|
|
1375
|
+
}
|
|
1376
|
+
function j(t, e, s) {
|
|
1377
|
+
return [t[0] + (e[0] - t[0]) * s, t[1] + (e[1] - t[1]) * s];
|
|
1378
|
+
}
|
|
1379
|
+
function F(t, e, s, n) {
|
|
1380
|
+
var a = n || [];
|
|
1381
|
+
if (function (t, e) {
|
|
1382
|
+
var s = t[e + 0],
|
|
1383
|
+
n = t[e + 1],
|
|
1384
|
+
a = t[e + 2],
|
|
1385
|
+
o = t[e + 3];
|
|
1386
|
+
var h = 3 * n[0] - 2 * s[0] - o[0];
|
|
1387
|
+
h *= h;
|
|
1388
|
+
var r = 3 * n[1] - 2 * s[1] - o[1];
|
|
1389
|
+
r *= r;
|
|
1390
|
+
var i = 3 * a[0] - 2 * o[0] - s[0];
|
|
1391
|
+
i *= i;
|
|
1392
|
+
var c = 3 * a[1] - 2 * o[1] - s[1];
|
|
1393
|
+
return c *= c, h < i && (h = i), r < c && (r = c), h + r;
|
|
1394
|
+
}(t, e) < s) {
|
|
1395
|
+
var _s11 = t[e + 0];
|
|
1396
|
+
if (a.length) {
|
|
1397
|
+
(o = a[a.length - 1], h = _s11, Math.sqrt(R(o, h))) > 1 && a.push(_s11);
|
|
1398
|
+
} else a.push(_s11);
|
|
1399
|
+
a.push(t[e + 3]);
|
|
1400
|
+
} else {
|
|
1401
|
+
var _n10 = .5,
|
|
1402
|
+
_o12 = t[e + 0],
|
|
1403
|
+
_h13 = t[e + 1],
|
|
1404
|
+
_r13 = t[e + 2],
|
|
1405
|
+
_i7 = t[e + 3],
|
|
1406
|
+
_c9 = j(_o12, _h13, _n10),
|
|
1407
|
+
_l11 = j(_h13, _r13, _n10),
|
|
1408
|
+
_u7 = j(_r13, _i7, _n10),
|
|
1409
|
+
_p5 = j(_c9, _l11, _n10),
|
|
1410
|
+
_f4 = j(_l11, _u7, _n10),
|
|
1411
|
+
_d2 = j(_p5, _f4, _n10);
|
|
1412
|
+
F([_o12, _c9, _p5, _d2], 0, s, a), F([_d2, _f4, _u7, _i7], 0, s, a);
|
|
1413
|
+
}
|
|
1414
|
+
var o, h;
|
|
1415
|
+
return a;
|
|
1416
|
+
}
|
|
1417
|
+
function V(t, e) {
|
|
1418
|
+
return Z(t, 0, t.length, e);
|
|
1419
|
+
}
|
|
1420
|
+
function Z(t, e, s, n, a) {
|
|
1421
|
+
var o = a || [],
|
|
1422
|
+
h = t[e],
|
|
1423
|
+
r = t[s - 1];
|
|
1424
|
+
var i = 0,
|
|
1425
|
+
c = 1;
|
|
1426
|
+
for (var _n11 = e + 1; _n11 < s - 1; ++_n11) {
|
|
1427
|
+
var _e14 = q(t[_n11], h, r);
|
|
1428
|
+
_e14 > i && (i = _e14, c = _n11);
|
|
1429
|
+
}
|
|
1430
|
+
return Math.sqrt(i) > n ? (Z(t, e, c + 1, n, o), Z(t, c, s, n, o)) : (o.length || o.push(h), o.push(r)), o;
|
|
1431
|
+
}
|
|
1432
|
+
function Q(t) {
|
|
1433
|
+
var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .15;
|
|
1434
|
+
var s = arguments.length > 2 ? arguments[2] : undefined;
|
|
1435
|
+
var n = [],
|
|
1436
|
+
a = (t.length - 1) / 3;
|
|
1437
|
+
for (var _s12 = 0; _s12 < a; _s12++) {
|
|
1438
|
+
F(t, 3 * _s12, e, n);
|
|
1439
|
+
}
|
|
1440
|
+
return s && s > 0 ? Z(n, 0, n.length, s) : n;
|
|
1441
|
+
}
|
|
1442
|
+
var H = "none";
|
|
1443
|
+
var N = /*#__PURE__*/function () {
|
|
1444
|
+
function N(t) {
|
|
1445
|
+
_classCallCheck(this, N);
|
|
1446
|
+
this.defaultOptions = {
|
|
1447
|
+
maxRandomnessOffset: 2,
|
|
1448
|
+
roughness: 1,
|
|
1449
|
+
bowing: 1,
|
|
1450
|
+
stroke: "#000",
|
|
1451
|
+
strokeWidth: 1,
|
|
1452
|
+
curveTightness: 0,
|
|
1453
|
+
curveFitting: .95,
|
|
1454
|
+
curveStepCount: 9,
|
|
1455
|
+
fillStyle: "hachure",
|
|
1456
|
+
fillWeight: -1,
|
|
1457
|
+
hachureAngle: -41,
|
|
1458
|
+
hachureGap: -1,
|
|
1459
|
+
dashOffset: -1,
|
|
1460
|
+
dashGap: -1,
|
|
1461
|
+
zigzagOffset: -1,
|
|
1462
|
+
seed: 0,
|
|
1463
|
+
disableMultiStroke: !1,
|
|
1464
|
+
disableMultiStrokeFill: !1,
|
|
1465
|
+
preserveVertices: !1
|
|
1466
|
+
}, this.config = t || {}, this.config.options && (this.defaultOptions = this._o(this.config.options));
|
|
1467
|
+
}
|
|
1468
|
+
_createClass(N, [{
|
|
1469
|
+
key: "_o",
|
|
1470
|
+
value: function _o(t) {
|
|
1471
|
+
return t ? Object.assign({}, this.defaultOptions, t) : this.defaultOptions;
|
|
1472
|
+
}
|
|
1473
|
+
}, {
|
|
1474
|
+
key: "_d",
|
|
1475
|
+
value: function _d(t, e, s) {
|
|
1476
|
+
return {
|
|
1477
|
+
shape: t,
|
|
1478
|
+
sets: e || [],
|
|
1479
|
+
options: s || this.defaultOptions
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
}, {
|
|
1483
|
+
key: "line",
|
|
1484
|
+
value: function line(t, e, s, n, a) {
|
|
1485
|
+
var o = this._o(a);
|
|
1486
|
+
return this._d("line", [y(t, e, s, n, o)], o);
|
|
1487
|
+
}
|
|
1488
|
+
}, {
|
|
1489
|
+
key: "rectangle",
|
|
1490
|
+
value: function rectangle(t, e, s, n, a) {
|
|
1491
|
+
var o = this._o(a),
|
|
1492
|
+
h = [],
|
|
1493
|
+
r = w(t, e, s, n, o);
|
|
1494
|
+
if (o.fill) {
|
|
1495
|
+
var _a9 = [[t, e], [t + s, e], [t + s, e + n], [t, e + n]];
|
|
1496
|
+
"solid" === o.fillStyle ? h.push(S([_a9], o)) : h.push(L([_a9], o));
|
|
1497
|
+
}
|
|
1498
|
+
return o.stroke !== H && h.push(r), this._d("rectangle", h, o);
|
|
1499
|
+
}
|
|
1500
|
+
}, {
|
|
1501
|
+
key: "ellipse",
|
|
1502
|
+
value: function ellipse(t, e, s, n, a) {
|
|
1503
|
+
var o = this._o(a),
|
|
1504
|
+
h = [],
|
|
1505
|
+
r = P(s, n, o),
|
|
1506
|
+
i = v(t, e, o, r);
|
|
1507
|
+
if (o.fill) if ("solid" === o.fillStyle) {
|
|
1508
|
+
var _s13 = v(t, e, o, r).opset;
|
|
1509
|
+
_s13.type = "fillPath", h.push(_s13);
|
|
1510
|
+
} else h.push(L([i.estimatedPoints], o));
|
|
1511
|
+
return o.stroke !== H && h.push(i.opset), this._d("ellipse", h, o);
|
|
1512
|
+
}
|
|
1513
|
+
}, {
|
|
1514
|
+
key: "circle",
|
|
1515
|
+
value: function circle(t, e, s, n) {
|
|
1516
|
+
var a = this.ellipse(t, e, s, s, n);
|
|
1517
|
+
return a.shape = "circle", a;
|
|
1518
|
+
}
|
|
1519
|
+
}, {
|
|
1520
|
+
key: "linearPath",
|
|
1521
|
+
value: function linearPath(t, e) {
|
|
1522
|
+
var s = this._o(e);
|
|
1523
|
+
return this._d("linearPath", [m(t, !1, s)], s);
|
|
1524
|
+
}
|
|
1525
|
+
}, {
|
|
1526
|
+
key: "arc",
|
|
1527
|
+
value: function arc(t, e, s, n, a, o) {
|
|
1528
|
+
var h = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
|
|
1529
|
+
var r = arguments.length > 7 ? arguments[7] : undefined;
|
|
1530
|
+
var i = this._o(r),
|
|
1531
|
+
c = [],
|
|
1532
|
+
l = O(t, e, s, n, a, o, h, !0, i);
|
|
1533
|
+
if (h && i.fill) if ("solid" === i.fillStyle) {
|
|
1534
|
+
var _h14 = Object.assign({}, i);
|
|
1535
|
+
_h14.disableMultiStroke = !0;
|
|
1536
|
+
var _r14 = O(t, e, s, n, a, o, !0, !1, _h14);
|
|
1537
|
+
_r14.type = "fillPath", c.push(_r14);
|
|
1538
|
+
} else c.push(function (t, e, s, n, a, o, h) {
|
|
1539
|
+
var r = t,
|
|
1540
|
+
i = e;
|
|
1541
|
+
var c = Math.abs(s / 2),
|
|
1542
|
+
l = Math.abs(n / 2);
|
|
1543
|
+
c += A(.01 * c, h), l += A(.01 * l, h);
|
|
1544
|
+
var u = a,
|
|
1545
|
+
p = o;
|
|
1546
|
+
for (; u < 0;) u += 2 * Math.PI, p += 2 * Math.PI;
|
|
1547
|
+
p - u > 2 * Math.PI && (u = 0, p = 2 * Math.PI);
|
|
1548
|
+
var f = (p - u) / h.curveStepCount,
|
|
1549
|
+
d = [];
|
|
1550
|
+
for (var _t28 = u; _t28 <= p; _t28 += f) d.push([r + c * Math.cos(_t28), i + l * Math.sin(_t28)]);
|
|
1551
|
+
return d.push([r + c * Math.cos(p), i + l * Math.sin(p)]), d.push([r, i]), L([d], h);
|
|
1552
|
+
}(t, e, s, n, a, o, i));
|
|
1553
|
+
return i.stroke !== H && c.push(l), this._d("arc", c, i);
|
|
1554
|
+
}
|
|
1555
|
+
}, {
|
|
1556
|
+
key: "curve",
|
|
1557
|
+
value: function curve(t, e) {
|
|
1558
|
+
var s = this._o(e),
|
|
1559
|
+
n = [],
|
|
1560
|
+
a = x(t, s);
|
|
1561
|
+
if (s.fill && s.fill !== H && t.length >= 3) {
|
|
1562
|
+
var _e15 = Q(function (t) {
|
|
1563
|
+
var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1564
|
+
var s = t.length;
|
|
1565
|
+
if (s < 3) throw new Error("A curve must have at least three points.");
|
|
1566
|
+
var n = [];
|
|
1567
|
+
if (3 === s) n.push(G(t[0]), G(t[1]), G(t[2]), G(t[2]));else {
|
|
1568
|
+
var _s14 = [];
|
|
1569
|
+
_s14.push(t[0], t[0]);
|
|
1570
|
+
for (var _e16 = 1; _e16 < t.length; _e16++) _s14.push(t[_e16]), _e16 === t.length - 1 && _s14.push(t[_e16]);
|
|
1571
|
+
var _a10 = [],
|
|
1572
|
+
_o13 = 1 - e;
|
|
1573
|
+
n.push(G(_s14[0]));
|
|
1574
|
+
for (var _t29 = 1; _t29 + 2 < _s14.length; _t29++) {
|
|
1575
|
+
var _e17 = _s14[_t29];
|
|
1576
|
+
_a10[0] = [_e17[0], _e17[1]], _a10[1] = [_e17[0] + (_o13 * _s14[_t29 + 1][0] - _o13 * _s14[_t29 - 1][0]) / 6, _e17[1] + (_o13 * _s14[_t29 + 1][1] - _o13 * _s14[_t29 - 1][1]) / 6], _a10[2] = [_s14[_t29 + 1][0] + (_o13 * _s14[_t29][0] - _o13 * _s14[_t29 + 2][0]) / 6, _s14[_t29 + 1][1] + (_o13 * _s14[_t29][1] - _o13 * _s14[_t29 + 2][1]) / 6], _a10[3] = [_s14[_t29 + 1][0], _s14[_t29 + 1][1]], n.push(_a10[1], _a10[2], _a10[3]);
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
return n;
|
|
1580
|
+
}(t), 10, (1 + s.roughness) / 2);
|
|
1581
|
+
"solid" === s.fillStyle ? n.push(S([_e15], s)) : n.push(L([_e15], s));
|
|
1582
|
+
}
|
|
1583
|
+
return s.stroke !== H && n.push(a), this._d("curve", n, s);
|
|
1584
|
+
}
|
|
1585
|
+
}, {
|
|
1586
|
+
key: "polygon",
|
|
1587
|
+
value: function polygon(t, e) {
|
|
1588
|
+
var s = this._o(e),
|
|
1589
|
+
n = [],
|
|
1590
|
+
a = m(t, !0, s);
|
|
1591
|
+
return s.fill && ("solid" === s.fillStyle ? n.push(S([t], s)) : n.push(L([t], s))), s.stroke !== H && n.push(a), this._d("polygon", n, s);
|
|
1592
|
+
}
|
|
1593
|
+
}, {
|
|
1594
|
+
key: "path",
|
|
1595
|
+
value: function path(t, e) {
|
|
1596
|
+
var s = this._o(e),
|
|
1597
|
+
n = [];
|
|
1598
|
+
if (!t) return this._d("path", n, s);
|
|
1599
|
+
t = (t || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " ");
|
|
1600
|
+
var a = s.fill && "transparent" !== s.fill && s.fill !== H,
|
|
1601
|
+
o = s.stroke !== H,
|
|
1602
|
+
h = !!(s.simplification && s.simplification < 1),
|
|
1603
|
+
r = function (t, e, s) {
|
|
1604
|
+
var n = g(d(f(t))),
|
|
1605
|
+
a = [];
|
|
1606
|
+
var o = [],
|
|
1607
|
+
h = [0, 0],
|
|
1608
|
+
r = [];
|
|
1609
|
+
var i = function i() {
|
|
1610
|
+
var _o14;
|
|
1611
|
+
r.length >= 4 && (_o14 = o).push.apply(_o14, _toConsumableArray(Q(r, e))), r = [];
|
|
1612
|
+
},
|
|
1613
|
+
c = function c() {
|
|
1614
|
+
i(), o.length && (a.push(o), o = []);
|
|
1615
|
+
};
|
|
1616
|
+
var _iterator10 = _createForOfIteratorHelper(n),
|
|
1617
|
+
_step10;
|
|
1618
|
+
try {
|
|
1619
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
1620
|
+
var _step10$value = _step10.value,
|
|
1621
|
+
_t31 = _step10$value.key,
|
|
1622
|
+
_e19 = _step10$value.data;
|
|
1623
|
+
switch (_t31) {
|
|
1624
|
+
case "M":
|
|
1625
|
+
c(), h = [_e19[0], _e19[1]], o.push(h);
|
|
1626
|
+
break;
|
|
1627
|
+
case "L":
|
|
1628
|
+
i(), o.push([_e19[0], _e19[1]]);
|
|
1629
|
+
break;
|
|
1630
|
+
case "C":
|
|
1631
|
+
if (!r.length) {
|
|
1632
|
+
var _t32 = o.length ? o[o.length - 1] : h;
|
|
1633
|
+
r.push([_t32[0], _t32[1]]);
|
|
1634
|
+
}
|
|
1635
|
+
r.push([_e19[0], _e19[1]]), r.push([_e19[2], _e19[3]]), r.push([_e19[4], _e19[5]]);
|
|
1636
|
+
break;
|
|
1637
|
+
case "Z":
|
|
1638
|
+
i(), o.push([h[0], h[1]]);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
} catch (err) {
|
|
1642
|
+
_iterator10.e(err);
|
|
1643
|
+
} finally {
|
|
1644
|
+
_iterator10.f();
|
|
1645
|
+
}
|
|
1646
|
+
if (c(), !s) return a;
|
|
1647
|
+
var l = [];
|
|
1648
|
+
for (var _i8 = 0, _a11 = a; _i8 < _a11.length; _i8++) {
|
|
1649
|
+
var _t30 = _a11[_i8];
|
|
1650
|
+
var _e18 = V(_t30, s);
|
|
1651
|
+
_e18.length && l.push(_e18);
|
|
1652
|
+
}
|
|
1653
|
+
return l;
|
|
1654
|
+
}(t, 1, h ? 4 - 4 * s.simplification : (1 + s.roughness) / 2);
|
|
1655
|
+
return a && ("solid" === s.fillStyle ? n.push(S(r, s)) : n.push(L(r, s))), o && (h ? r.forEach(function (t) {
|
|
1656
|
+
n.push(m(t, !1, s));
|
|
1657
|
+
}) : n.push(function (t, e) {
|
|
1658
|
+
var s = g(d(f(t))),
|
|
1659
|
+
n = [];
|
|
1660
|
+
var a = [0, 0],
|
|
1661
|
+
o = [0, 0];
|
|
1662
|
+
var _iterator11 = _createForOfIteratorHelper(s),
|
|
1663
|
+
_step11;
|
|
1664
|
+
try {
|
|
1665
|
+
var _loop = function _loop() {
|
|
1666
|
+
var _step11$value = _step11.value,
|
|
1667
|
+
t = _step11$value.key,
|
|
1668
|
+
h = _step11$value.data;
|
|
1669
|
+
switch (t) {
|
|
1670
|
+
case "M":
|
|
1671
|
+
{
|
|
1672
|
+
var _t33 = 1 * (e.maxRandomnessOffset || 0),
|
|
1673
|
+
_s15 = e.preserveVertices;
|
|
1674
|
+
n.push({
|
|
1675
|
+
op: "move",
|
|
1676
|
+
data: h.map(function (n) {
|
|
1677
|
+
return n + (_s15 ? 0 : A(_t33, e));
|
|
1678
|
+
})
|
|
1679
|
+
}), o = [h[0], h[1]], a = [h[0], h[1]];
|
|
1680
|
+
break;
|
|
1681
|
+
}
|
|
1682
|
+
case "L":
|
|
1683
|
+
n.push.apply(n, _toConsumableArray(I(o[0], o[1], h[0], h[1], e))), o = [h[0], h[1]];
|
|
1684
|
+
break;
|
|
1685
|
+
case "C":
|
|
1686
|
+
{
|
|
1687
|
+
var _h15 = _slicedToArray(h, 6),
|
|
1688
|
+
_t34 = _h15[0],
|
|
1689
|
+
_s16 = _h15[1],
|
|
1690
|
+
_a12 = _h15[2],
|
|
1691
|
+
_r15 = _h15[3],
|
|
1692
|
+
_i9 = _h15[4],
|
|
1693
|
+
_c10 = _h15[5];
|
|
1694
|
+
n.push.apply(n, _toConsumableArray($(_t34, _s16, _a12, _r15, _i9, _c10, o, e))), o = [_i9, _c10];
|
|
1695
|
+
break;
|
|
1696
|
+
}
|
|
1697
|
+
case "Z":
|
|
1698
|
+
n.push.apply(n, _toConsumableArray(I(o[0], o[1], a[0], a[1], e))), o = [a[0], a[1]];
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
1702
|
+
_loop();
|
|
1703
|
+
}
|
|
1704
|
+
} catch (err) {
|
|
1705
|
+
_iterator11.e(err);
|
|
1706
|
+
} finally {
|
|
1707
|
+
_iterator11.f();
|
|
1708
|
+
}
|
|
1709
|
+
return {
|
|
1710
|
+
type: "path",
|
|
1711
|
+
ops: n
|
|
1712
|
+
};
|
|
1713
|
+
}(t, s))), this._d("path", n, s);
|
|
1714
|
+
}
|
|
1715
|
+
}, {
|
|
1716
|
+
key: "opsToPath",
|
|
1717
|
+
value: function opsToPath(t, e) {
|
|
1718
|
+
var s = "";
|
|
1719
|
+
var _iterator12 = _createForOfIteratorHelper(t.ops),
|
|
1720
|
+
_step12;
|
|
1721
|
+
try {
|
|
1722
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
1723
|
+
var _n12 = _step12.value;
|
|
1724
|
+
var _t35 = "number" == typeof e && e >= 0 ? _n12.data.map(function (t) {
|
|
1725
|
+
return +t.toFixed(e);
|
|
1726
|
+
}) : _n12.data;
|
|
1727
|
+
switch (_n12.op) {
|
|
1728
|
+
case "move":
|
|
1729
|
+
s += "M".concat(_t35[0], " ").concat(_t35[1], " ");
|
|
1730
|
+
break;
|
|
1731
|
+
case "bcurveTo":
|
|
1732
|
+
s += "C".concat(_t35[0], " ").concat(_t35[1], ", ").concat(_t35[2], " ").concat(_t35[3], ", ").concat(_t35[4], " ").concat(_t35[5], " ");
|
|
1733
|
+
break;
|
|
1734
|
+
case "lineTo":
|
|
1735
|
+
s += "L".concat(_t35[0], " ").concat(_t35[1], " ");
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
} catch (err) {
|
|
1739
|
+
_iterator12.e(err);
|
|
1740
|
+
} finally {
|
|
1741
|
+
_iterator12.f();
|
|
1742
|
+
}
|
|
1743
|
+
return s.trim();
|
|
1744
|
+
}
|
|
1745
|
+
}, {
|
|
1746
|
+
key: "toPaths",
|
|
1747
|
+
value: function toPaths(t) {
|
|
1748
|
+
var e = t.sets || [],
|
|
1749
|
+
s = t.options || this.defaultOptions,
|
|
1750
|
+
n = [];
|
|
1751
|
+
var _iterator13 = _createForOfIteratorHelper(e),
|
|
1752
|
+
_step13;
|
|
1753
|
+
try {
|
|
1754
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
1755
|
+
var _t36 = _step13.value;
|
|
1756
|
+
var _e20 = null;
|
|
1757
|
+
switch (_t36.type) {
|
|
1758
|
+
case "path":
|
|
1759
|
+
_e20 = {
|
|
1760
|
+
d: this.opsToPath(_t36),
|
|
1761
|
+
stroke: s.stroke,
|
|
1762
|
+
strokeWidth: s.strokeWidth,
|
|
1763
|
+
fill: H
|
|
1764
|
+
};
|
|
1765
|
+
break;
|
|
1766
|
+
case "fillPath":
|
|
1767
|
+
_e20 = {
|
|
1768
|
+
d: this.opsToPath(_t36),
|
|
1769
|
+
stroke: H,
|
|
1770
|
+
strokeWidth: 0,
|
|
1771
|
+
fill: s.fill || H
|
|
1772
|
+
};
|
|
1773
|
+
break;
|
|
1774
|
+
case "fillSketch":
|
|
1775
|
+
_e20 = this.fillSketch(_t36, s);
|
|
1776
|
+
}
|
|
1777
|
+
_e20 && n.push(_e20);
|
|
1778
|
+
}
|
|
1779
|
+
} catch (err) {
|
|
1780
|
+
_iterator13.e(err);
|
|
1781
|
+
} finally {
|
|
1782
|
+
_iterator13.f();
|
|
1783
|
+
}
|
|
1784
|
+
return n;
|
|
1785
|
+
}
|
|
1786
|
+
}, {
|
|
1787
|
+
key: "fillSketch",
|
|
1788
|
+
value: function fillSketch(t, e) {
|
|
1789
|
+
var s = e.fillWeight;
|
|
1790
|
+
return s < 0 && (s = e.strokeWidth / 2), {
|
|
1791
|
+
d: this.opsToPath(t),
|
|
1792
|
+
stroke: e.fill || H,
|
|
1793
|
+
strokeWidth: s,
|
|
1794
|
+
fill: H
|
|
1795
|
+
};
|
|
1796
|
+
}
|
|
1797
|
+
}], [{
|
|
1798
|
+
key: "newSeed",
|
|
1799
|
+
value: function newSeed() {
|
|
1800
|
+
return Math.floor(Math.random() * Math.pow(2, 31));
|
|
1801
|
+
}
|
|
1802
|
+
}]);
|
|
1803
|
+
return N;
|
|
1804
|
+
}();
|
|
1805
|
+
var B = /*#__PURE__*/function () {
|
|
1806
|
+
function B(t, e) {
|
|
1807
|
+
_classCallCheck(this, B);
|
|
1808
|
+
this.canvas = t, this.ctx = this.canvas.getContext("2d"), this.gen = new N(e);
|
|
1809
|
+
}
|
|
1810
|
+
_createClass(B, [{
|
|
1811
|
+
key: "draw",
|
|
1812
|
+
value: function draw(t) {
|
|
1813
|
+
var e = t.sets || [],
|
|
1814
|
+
s = t.options || this.getDefaultOptions(),
|
|
1815
|
+
n = this.ctx,
|
|
1816
|
+
a = t.options.fixedDecimalPlaceDigits;
|
|
1817
|
+
var _iterator14 = _createForOfIteratorHelper(e),
|
|
1818
|
+
_step14;
|
|
1819
|
+
try {
|
|
1820
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
1821
|
+
var _o15 = _step14.value;
|
|
1822
|
+
switch (_o15.type) {
|
|
1823
|
+
case "path":
|
|
1824
|
+
n.save(), n.strokeStyle = "none" === s.stroke ? "transparent" : s.stroke, n.lineWidth = s.strokeWidth, s.strokeLineDash && n.setLineDash(s.strokeLineDash), s.strokeLineDashOffset && (n.lineDashOffset = s.strokeLineDashOffset), this._drawToContext(n, _o15, a), n.restore();
|
|
1825
|
+
break;
|
|
1826
|
+
case "fillPath":
|
|
1827
|
+
{
|
|
1828
|
+
n.save(), n.fillStyle = s.fill || "";
|
|
1829
|
+
var _e21 = "curve" === t.shape || "polygon" === t.shape || "path" === t.shape ? "evenodd" : "nonzero";
|
|
1830
|
+
this._drawToContext(n, _o15, a, _e21), n.restore();
|
|
1831
|
+
break;
|
|
1832
|
+
}
|
|
1833
|
+
case "fillSketch":
|
|
1834
|
+
this.fillSketch(n, _o15, s);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
} catch (err) {
|
|
1838
|
+
_iterator14.e(err);
|
|
1839
|
+
} finally {
|
|
1840
|
+
_iterator14.f();
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
}, {
|
|
1844
|
+
key: "fillSketch",
|
|
1845
|
+
value: function fillSketch(t, e, s) {
|
|
1846
|
+
var n = s.fillWeight;
|
|
1847
|
+
n < 0 && (n = s.strokeWidth / 2), t.save(), s.fillLineDash && t.setLineDash(s.fillLineDash), s.fillLineDashOffset && (t.lineDashOffset = s.fillLineDashOffset), t.strokeStyle = s.fill || "", t.lineWidth = n, this._drawToContext(t, e, s.fixedDecimalPlaceDigits), t.restore();
|
|
1848
|
+
}
|
|
1849
|
+
}, {
|
|
1850
|
+
key: "_drawToContext",
|
|
1851
|
+
value: function _drawToContext(t, e, s) {
|
|
1852
|
+
var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "nonzero";
|
|
1853
|
+
t.beginPath();
|
|
1854
|
+
var _iterator15 = _createForOfIteratorHelper(e.ops),
|
|
1855
|
+
_step15;
|
|
1856
|
+
try {
|
|
1857
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
1858
|
+
var _n13 = _step15.value;
|
|
1859
|
+
var _e22 = "number" == typeof s && s >= 0 ? _n13.data.map(function (t) {
|
|
1860
|
+
return +t.toFixed(s);
|
|
1861
|
+
}) : _n13.data;
|
|
1862
|
+
switch (_n13.op) {
|
|
1863
|
+
case "move":
|
|
1864
|
+
t.moveTo(_e22[0], _e22[1]);
|
|
1865
|
+
break;
|
|
1866
|
+
case "bcurveTo":
|
|
1867
|
+
t.bezierCurveTo(_e22[0], _e22[1], _e22[2], _e22[3], _e22[4], _e22[5]);
|
|
1868
|
+
break;
|
|
1869
|
+
case "lineTo":
|
|
1870
|
+
t.lineTo(_e22[0], _e22[1]);
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
} catch (err) {
|
|
1874
|
+
_iterator15.e(err);
|
|
1875
|
+
} finally {
|
|
1876
|
+
_iterator15.f();
|
|
1877
|
+
}
|
|
1878
|
+
"fillPath" === e.type ? t.fill(n) : t.stroke();
|
|
1879
|
+
}
|
|
1880
|
+
}, {
|
|
1881
|
+
key: "generator",
|
|
1882
|
+
get: function get() {
|
|
1883
|
+
return this.gen;
|
|
1884
|
+
}
|
|
1885
|
+
}, {
|
|
1886
|
+
key: "getDefaultOptions",
|
|
1887
|
+
value: function getDefaultOptions() {
|
|
1888
|
+
return this.gen.defaultOptions;
|
|
1889
|
+
}
|
|
1890
|
+
}, {
|
|
1891
|
+
key: "line",
|
|
1892
|
+
value: function line(t, e, s, n, a) {
|
|
1893
|
+
var o = this.gen.line(t, e, s, n, a);
|
|
1894
|
+
return this.draw(o), o;
|
|
1895
|
+
}
|
|
1896
|
+
}, {
|
|
1897
|
+
key: "rectangle",
|
|
1898
|
+
value: function rectangle(t, e, s, n, a) {
|
|
1899
|
+
var o = this.gen.rectangle(t, e, s, n, a);
|
|
1900
|
+
return this.draw(o), o;
|
|
1901
|
+
}
|
|
1902
|
+
}, {
|
|
1903
|
+
key: "ellipse",
|
|
1904
|
+
value: function ellipse(t, e, s, n, a) {
|
|
1905
|
+
var o = this.gen.ellipse(t, e, s, n, a);
|
|
1906
|
+
return this.draw(o), o;
|
|
1907
|
+
}
|
|
1908
|
+
}, {
|
|
1909
|
+
key: "circle",
|
|
1910
|
+
value: function circle(t, e, s, n) {
|
|
1911
|
+
var a = this.gen.circle(t, e, s, n);
|
|
1912
|
+
return this.draw(a), a;
|
|
1913
|
+
}
|
|
1914
|
+
}, {
|
|
1915
|
+
key: "linearPath",
|
|
1916
|
+
value: function linearPath(t, e) {
|
|
1917
|
+
var s = this.gen.linearPath(t, e);
|
|
1918
|
+
return this.draw(s), s;
|
|
1919
|
+
}
|
|
1920
|
+
}, {
|
|
1921
|
+
key: "polygon",
|
|
1922
|
+
value: function polygon(t, e) {
|
|
1923
|
+
var s = this.gen.polygon(t, e);
|
|
1924
|
+
return this.draw(s), s;
|
|
1925
|
+
}
|
|
1926
|
+
}, {
|
|
1927
|
+
key: "arc",
|
|
1928
|
+
value: function arc(t, e, s, n, a, o) {
|
|
1929
|
+
var h = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
|
|
1930
|
+
var r = arguments.length > 7 ? arguments[7] : undefined;
|
|
1931
|
+
var i = this.gen.arc(t, e, s, n, a, o, h, r);
|
|
1932
|
+
return this.draw(i), i;
|
|
1933
|
+
}
|
|
1934
|
+
}, {
|
|
1935
|
+
key: "curve",
|
|
1936
|
+
value: function curve(t, e) {
|
|
1937
|
+
var s = this.gen.curve(t, e);
|
|
1938
|
+
return this.draw(s), s;
|
|
1939
|
+
}
|
|
1940
|
+
}, {
|
|
1941
|
+
key: "path",
|
|
1942
|
+
value: function path(t, e) {
|
|
1943
|
+
var s = this.gen.path(t, e);
|
|
1944
|
+
return this.draw(s), s;
|
|
1945
|
+
}
|
|
1946
|
+
}]);
|
|
1947
|
+
return B;
|
|
1948
|
+
}();
|
|
1949
|
+
var J = "http://www.w3.org/2000/svg";
|
|
1950
|
+
var K = /*#__PURE__*/function () {
|
|
1951
|
+
function K(t, e) {
|
|
1952
|
+
_classCallCheck(this, K);
|
|
1953
|
+
this.svg = t, this.gen = new N(e);
|
|
1954
|
+
}
|
|
1955
|
+
_createClass(K, [{
|
|
1956
|
+
key: "draw",
|
|
1957
|
+
value: function draw(t) {
|
|
1958
|
+
var e = t.sets || [],
|
|
1959
|
+
s = t.options || this.getDefaultOptions(),
|
|
1960
|
+
n = this.svg.ownerDocument || window.document,
|
|
1961
|
+
a = n.createElementNS(J, "g"),
|
|
1962
|
+
o = t.options.fixedDecimalPlaceDigits;
|
|
1963
|
+
var _iterator16 = _createForOfIteratorHelper(e),
|
|
1964
|
+
_step16;
|
|
1965
|
+
try {
|
|
1966
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
1967
|
+
var _h16 = _step16.value;
|
|
1968
|
+
var _e23 = null;
|
|
1969
|
+
switch (_h16.type) {
|
|
1970
|
+
case "path":
|
|
1971
|
+
_e23 = n.createElementNS(J, "path"), _e23.setAttribute("d", this.opsToPath(_h16, o)), _e23.setAttribute("stroke", s.stroke), _e23.setAttribute("stroke-width", s.strokeWidth + ""), _e23.setAttribute("fill", "none"), s.strokeLineDash && _e23.setAttribute("stroke-dasharray", s.strokeLineDash.join(" ").trim()), s.strokeLineDashOffset && _e23.setAttribute("stroke-dashoffset", "".concat(s.strokeLineDashOffset));
|
|
1972
|
+
break;
|
|
1973
|
+
case "fillPath":
|
|
1974
|
+
_e23 = n.createElementNS(J, "path"), _e23.setAttribute("d", this.opsToPath(_h16, o)), _e23.setAttribute("stroke", "none"), _e23.setAttribute("stroke-width", "0"), _e23.setAttribute("fill", s.fill || ""), "curve" !== t.shape && "polygon" !== t.shape || _e23.setAttribute("fill-rule", "evenodd");
|
|
1975
|
+
break;
|
|
1976
|
+
case "fillSketch":
|
|
1977
|
+
_e23 = this.fillSketch(n, _h16, s);
|
|
1978
|
+
}
|
|
1979
|
+
_e23 && a.appendChild(_e23);
|
|
1980
|
+
}
|
|
1981
|
+
} catch (err) {
|
|
1982
|
+
_iterator16.e(err);
|
|
1983
|
+
} finally {
|
|
1984
|
+
_iterator16.f();
|
|
1985
|
+
}
|
|
1986
|
+
return a;
|
|
1987
|
+
}
|
|
1988
|
+
}, {
|
|
1989
|
+
key: "fillSketch",
|
|
1990
|
+
value: function fillSketch(t, e, s) {
|
|
1991
|
+
var n = s.fillWeight;
|
|
1992
|
+
n < 0 && (n = s.strokeWidth / 2);
|
|
1993
|
+
var a = t.createElementNS(J, "path");
|
|
1994
|
+
return a.setAttribute("d", this.opsToPath(e, s.fixedDecimalPlaceDigits)), a.setAttribute("stroke", s.fill || ""), a.setAttribute("stroke-width", n + ""), a.setAttribute("fill", "none"), s.fillLineDash && a.setAttribute("stroke-dasharray", s.fillLineDash.join(" ").trim()), s.fillLineDashOffset && a.setAttribute("stroke-dashoffset", "".concat(s.fillLineDashOffset)), a;
|
|
1995
|
+
}
|
|
1996
|
+
}, {
|
|
1997
|
+
key: "generator",
|
|
1998
|
+
get: function get() {
|
|
1999
|
+
return this.gen;
|
|
2000
|
+
}
|
|
2001
|
+
}, {
|
|
2002
|
+
key: "getDefaultOptions",
|
|
2003
|
+
value: function getDefaultOptions() {
|
|
2004
|
+
return this.gen.defaultOptions;
|
|
2005
|
+
}
|
|
2006
|
+
}, {
|
|
2007
|
+
key: "opsToPath",
|
|
2008
|
+
value: function opsToPath(t, e) {
|
|
2009
|
+
return this.gen.opsToPath(t, e);
|
|
2010
|
+
}
|
|
2011
|
+
}, {
|
|
2012
|
+
key: "line",
|
|
2013
|
+
value: function line(t, e, s, n, a) {
|
|
2014
|
+
var o = this.gen.line(t, e, s, n, a);
|
|
2015
|
+
return this.draw(o);
|
|
2016
|
+
}
|
|
2017
|
+
}, {
|
|
2018
|
+
key: "rectangle",
|
|
2019
|
+
value: function rectangle(t, e, s, n, a) {
|
|
2020
|
+
var o = this.gen.rectangle(t, e, s, n, a);
|
|
2021
|
+
return this.draw(o);
|
|
2022
|
+
}
|
|
2023
|
+
}, {
|
|
2024
|
+
key: "ellipse",
|
|
2025
|
+
value: function ellipse(t, e, s, n, a) {
|
|
2026
|
+
var o = this.gen.ellipse(t, e, s, n, a);
|
|
2027
|
+
return this.draw(o);
|
|
2028
|
+
}
|
|
2029
|
+
}, {
|
|
2030
|
+
key: "circle",
|
|
2031
|
+
value: function circle(t, e, s, n) {
|
|
2032
|
+
var a = this.gen.circle(t, e, s, n);
|
|
2033
|
+
return this.draw(a);
|
|
2034
|
+
}
|
|
2035
|
+
}, {
|
|
2036
|
+
key: "linearPath",
|
|
2037
|
+
value: function linearPath(t, e) {
|
|
2038
|
+
var s = this.gen.linearPath(t, e);
|
|
2039
|
+
return this.draw(s);
|
|
2040
|
+
}
|
|
2041
|
+
}, {
|
|
2042
|
+
key: "polygon",
|
|
2043
|
+
value: function polygon(t, e) {
|
|
2044
|
+
var s = this.gen.polygon(t, e);
|
|
2045
|
+
return this.draw(s);
|
|
2046
|
+
}
|
|
2047
|
+
}, {
|
|
2048
|
+
key: "arc",
|
|
2049
|
+
value: function arc(t, e, s, n, a, o) {
|
|
2050
|
+
var h = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
|
|
2051
|
+
var r = arguments.length > 7 ? arguments[7] : undefined;
|
|
2052
|
+
var i = this.gen.arc(t, e, s, n, a, o, h, r);
|
|
2053
|
+
return this.draw(i);
|
|
2054
|
+
}
|
|
2055
|
+
}, {
|
|
2056
|
+
key: "curve",
|
|
2057
|
+
value: function curve(t, e) {
|
|
2058
|
+
var s = this.gen.curve(t, e);
|
|
2059
|
+
return this.draw(s);
|
|
2060
|
+
}
|
|
2061
|
+
}, {
|
|
2062
|
+
key: "path",
|
|
2063
|
+
value: function path(t, e) {
|
|
2064
|
+
var s = this.gen.path(t, e);
|
|
2065
|
+
return this.draw(s);
|
|
2066
|
+
}
|
|
2067
|
+
}]);
|
|
2068
|
+
return K;
|
|
2069
|
+
}();
|
|
2070
|
+
var U = {
|
|
2071
|
+
canvas: function canvas(t, e) {
|
|
2072
|
+
return new B(t, e);
|
|
2073
|
+
},
|
|
2074
|
+
svg: function svg(t, e) {
|
|
2075
|
+
return new K(t, e);
|
|
2076
|
+
},
|
|
2077
|
+
generator: function generator(t) {
|
|
2078
|
+
return new N(t);
|
|
2079
|
+
},
|
|
2080
|
+
newSeed: function newSeed() {
|
|
2081
|
+
return N.newSeed();
|
|
2082
|
+
}
|
|
2083
|
+
};
|
|
2084
|
+
|
|
2085
|
+
const defaultRouthThemeSpec = {
|
|
2086
|
+
maxRandomnessOffset: 3,
|
|
2087
|
+
roughness: 1,
|
|
2088
|
+
bowing: 1,
|
|
2089
|
+
curveFitting: 0.95,
|
|
2090
|
+
curveTightness: undefined,
|
|
2091
|
+
curveStepCount: 9,
|
|
2092
|
+
fillStyle: 'hachure',
|
|
2093
|
+
fillWeight: undefined,
|
|
2094
|
+
hachureAngle: 60,
|
|
2095
|
+
hachureGap: 6,
|
|
2096
|
+
simplification: 0,
|
|
2097
|
+
dashOffset: undefined,
|
|
2098
|
+
dashGap: undefined,
|
|
2099
|
+
zigzagOffset: undefined,
|
|
2100
|
+
seed: 1,
|
|
2101
|
+
fillLineDash: undefined,
|
|
2102
|
+
fillLineDashOffset: undefined,
|
|
2103
|
+
disableMultiStroke: false,
|
|
2104
|
+
disableMultiStrokeFill: false,
|
|
2105
|
+
preserveVertices: true,
|
|
2106
|
+
fixedDecimalPlaceDigits: undefined
|
|
2107
|
+
};
|
|
2108
|
+
|
|
2109
|
+
let RoughCanvasArcRender = class RoughCanvasArcRender {
|
|
2110
|
+
canvasRenderer;
|
|
2111
|
+
type;
|
|
2112
|
+
numberType;
|
|
2113
|
+
style = 'rough';
|
|
2114
|
+
constructor(canvasRenderer) {
|
|
2115
|
+
this.canvasRenderer = canvasRenderer;
|
|
2116
|
+
this.type = 'arc';
|
|
2117
|
+
this.numberType = vrender.ARC_NUMBER_TYPE;
|
|
2118
|
+
}
|
|
2119
|
+
draw(arc, renderService, drawContext, params) {
|
|
2120
|
+
const { context } = drawContext;
|
|
2121
|
+
if (!context) {
|
|
2122
|
+
return;
|
|
2123
|
+
}
|
|
2124
|
+
const canvas = context.canvas.nativeCanvas;
|
|
2125
|
+
const rc = U.canvas(canvas);
|
|
2126
|
+
context.highPerformanceSave();
|
|
2127
|
+
const arcAttribute = vrender.getTheme(arc).arc;
|
|
2128
|
+
let { x = arcAttribute.x, y = arcAttribute.y } = arc.attribute;
|
|
2129
|
+
if (!arc.transMatrix.onlyTranslate()) {
|
|
2130
|
+
x = 0;
|
|
2131
|
+
y = 0;
|
|
2132
|
+
context.transformFromMatrix(arc.transMatrix, true);
|
|
2133
|
+
}
|
|
2134
|
+
else {
|
|
2135
|
+
const { dx = arcAttribute.dx, dy = arcAttribute.dy } = arc.attribute;
|
|
2136
|
+
x += dx;
|
|
2137
|
+
y += dy;
|
|
2138
|
+
context.setTransformForCurrent();
|
|
2139
|
+
}
|
|
2140
|
+
const customPath = new vrender.CustomPath2D();
|
|
2141
|
+
const { fill = arcAttribute.fill, stroke = arcAttribute.stroke, lineWidth = arcAttribute.lineWidth, outerRadius = arcAttribute.outerRadius, innerRadius = arcAttribute.innerRadius, maxRandomnessOffset = defaultRouthThemeSpec.maxRandomnessOffset, roughness = defaultRouthThemeSpec.roughness, bowing = defaultRouthThemeSpec.bowing, curveFitting = defaultRouthThemeSpec.curveFitting, curveTightness = defaultRouthThemeSpec.curveTightness, curveStepCount = defaultRouthThemeSpec.curveStepCount, fillStyle = defaultRouthThemeSpec.fillStyle, fillWeight = defaultRouthThemeSpec.fillWeight, hachureAngle = defaultRouthThemeSpec.hachureAngle, hachureGap = defaultRouthThemeSpec.hachureGap, simplification = defaultRouthThemeSpec.simplification, dashOffset = defaultRouthThemeSpec.dashOffset, dashGap = defaultRouthThemeSpec.dashGap, zigzagOffset = defaultRouthThemeSpec.zigzagOffset, seed = defaultRouthThemeSpec.seed, fillLineDash = defaultRouthThemeSpec.fillLineDash, fillLineDashOffset = defaultRouthThemeSpec.fillLineDashOffset, disableMultiStroke = defaultRouthThemeSpec.disableMultiStroke, disableMultiStrokeFill = defaultRouthThemeSpec.disableMultiStrokeFill, preserveVertices = defaultRouthThemeSpec.preserveVertices, fixedDecimalPlaceDigits = defaultRouthThemeSpec.fixedDecimalPlaceDigits } = arc.attribute;
|
|
2142
|
+
vrender.drawArcPath(arc, customPath, x, y, outerRadius, innerRadius);
|
|
2143
|
+
rc.path(customPath.toString(), {
|
|
2144
|
+
fill: fill ? fill : undefined,
|
|
2145
|
+
stroke: stroke ? stroke : undefined,
|
|
2146
|
+
strokeWidth: lineWidth,
|
|
2147
|
+
maxRandomnessOffset,
|
|
2148
|
+
roughness,
|
|
2149
|
+
bowing,
|
|
2150
|
+
curveFitting,
|
|
2151
|
+
curveTightness,
|
|
2152
|
+
curveStepCount,
|
|
2153
|
+
fillStyle,
|
|
2154
|
+
fillWeight,
|
|
2155
|
+
hachureAngle,
|
|
2156
|
+
hachureGap,
|
|
2157
|
+
simplification,
|
|
2158
|
+
dashOffset,
|
|
2159
|
+
dashGap,
|
|
2160
|
+
zigzagOffset,
|
|
2161
|
+
seed,
|
|
2162
|
+
fillLineDash,
|
|
2163
|
+
fillLineDashOffset,
|
|
2164
|
+
disableMultiStroke,
|
|
2165
|
+
disableMultiStrokeFill,
|
|
2166
|
+
preserveVertices,
|
|
2167
|
+
fixedDecimalPlaceDigits
|
|
2168
|
+
});
|
|
2169
|
+
context.highPerformanceRestore();
|
|
2170
|
+
}
|
|
2171
|
+
drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb) {
|
|
2172
|
+
if (this.canvasRenderer.drawShape) {
|
|
2173
|
+
return this.canvasRenderer.drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb);
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
};
|
|
2177
|
+
RoughCanvasArcRender = __decorate([
|
|
2178
|
+
inversify.injectable(),
|
|
2179
|
+
__param(0, inversify.inject(vrender.DefaultCanvasArcRender)),
|
|
2180
|
+
__metadata("design:paramtypes", [Object])
|
|
2181
|
+
], RoughCanvasArcRender);
|
|
2182
|
+
|
|
2183
|
+
let RoughCanvasAreaRender = class RoughCanvasAreaRender extends vrender.DefaultCanvasAreaRender {
|
|
2184
|
+
style = 'rough';
|
|
2185
|
+
drawSegmentItem(context, cache, fill, fillOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, fillCb) {
|
|
2186
|
+
if (fillCb) {
|
|
2187
|
+
return super.drawSegmentItem(context, cache, fill, fillOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, fillCb);
|
|
2188
|
+
}
|
|
2189
|
+
context.highPerformanceSave();
|
|
2190
|
+
const canvas = context.canvas.nativeCanvas;
|
|
2191
|
+
const rc = U.canvas(canvas, {});
|
|
2192
|
+
const customPath = new vrender.CustomPath2D();
|
|
2193
|
+
vrender.drawAreaSegments(customPath, cache, clipRange, {
|
|
2194
|
+
offsetX,
|
|
2195
|
+
offsetY
|
|
2196
|
+
});
|
|
2197
|
+
const { maxRandomnessOffset = defaultRouthThemeSpec.maxRandomnessOffset, roughness = defaultRouthThemeSpec.roughness, bowing = defaultRouthThemeSpec.bowing, curveFitting = defaultRouthThemeSpec.curveFitting, curveTightness = defaultRouthThemeSpec.curveTightness, curveStepCount = defaultRouthThemeSpec.curveStepCount, fillStyle = defaultRouthThemeSpec.fillStyle, fillWeight = defaultRouthThemeSpec.fillWeight, hachureAngle = defaultRouthThemeSpec.hachureAngle, hachureGap = defaultRouthThemeSpec.hachureGap, simplification = defaultRouthThemeSpec.simplification, dashOffset = defaultRouthThemeSpec.dashOffset, dashGap = defaultRouthThemeSpec.dashGap, zigzagOffset = defaultRouthThemeSpec.zigzagOffset, seed = defaultRouthThemeSpec.seed, fillLineDash = defaultRouthThemeSpec.fillLineDash, fillLineDashOffset = defaultRouthThemeSpec.fillLineDashOffset, disableMultiStroke = defaultRouthThemeSpec.disableMultiStroke, disableMultiStrokeFill = defaultRouthThemeSpec.disableMultiStrokeFill, preserveVertices = defaultRouthThemeSpec.preserveVertices, fixedDecimalPlaceDigits = defaultRouthThemeSpec.fixedDecimalPlaceDigits } = attribute;
|
|
2198
|
+
let { fill: fillColor, stroke: strokeColor, lineWidth } = attribute;
|
|
2199
|
+
if (Array.isArray(defaultAttribute)) {
|
|
2200
|
+
defaultAttribute.forEach(item => {
|
|
2201
|
+
fillColor = fillColor ?? item.fill;
|
|
2202
|
+
strokeColor = strokeColor ?? item.stroke;
|
|
2203
|
+
lineWidth = lineWidth ?? item.lineWidth;
|
|
2204
|
+
});
|
|
2205
|
+
}
|
|
2206
|
+
else {
|
|
2207
|
+
fillColor = fillColor ?? defaultAttribute.fill;
|
|
2208
|
+
strokeColor = strokeColor ?? defaultAttribute.stroke;
|
|
2209
|
+
lineWidth = lineWidth ?? defaultAttribute.lineWidth;
|
|
2210
|
+
}
|
|
2211
|
+
rc.path(customPath.toString(), {
|
|
2212
|
+
fill: fill ? fillColor : undefined,
|
|
2213
|
+
strokeWidth: lineWidth,
|
|
2214
|
+
maxRandomnessOffset,
|
|
2215
|
+
roughness,
|
|
2216
|
+
bowing,
|
|
2217
|
+
curveFitting,
|
|
2218
|
+
curveTightness,
|
|
2219
|
+
curveStepCount,
|
|
2220
|
+
fillStyle,
|
|
2221
|
+
fillWeight,
|
|
2222
|
+
hachureAngle,
|
|
2223
|
+
hachureGap,
|
|
2224
|
+
simplification,
|
|
2225
|
+
dashOffset,
|
|
2226
|
+
dashGap,
|
|
2227
|
+
zigzagOffset,
|
|
2228
|
+
seed,
|
|
2229
|
+
fillLineDash,
|
|
2230
|
+
fillLineDashOffset,
|
|
2231
|
+
disableMultiStroke,
|
|
2232
|
+
disableMultiStrokeFill,
|
|
2233
|
+
preserveVertices,
|
|
2234
|
+
fixedDecimalPlaceDigits
|
|
2235
|
+
});
|
|
2236
|
+
context.highPerformanceRestore();
|
|
2237
|
+
return false;
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
RoughCanvasAreaRender = __decorate([
|
|
2241
|
+
inversify.injectable()
|
|
2242
|
+
], RoughCanvasAreaRender);
|
|
2243
|
+
|
|
2244
|
+
let RoughCanvasCircleRender = class RoughCanvasCircleRender {
|
|
2245
|
+
canvasRenderer;
|
|
2246
|
+
style = 'rough';
|
|
2247
|
+
constructor(canvasRenderer) {
|
|
2248
|
+
this.canvasRenderer = canvasRenderer;
|
|
2249
|
+
this.type = 'circle';
|
|
2250
|
+
this.numberType = vrender.CIRCLE_NUMBER_TYPE;
|
|
2251
|
+
}
|
|
2252
|
+
draw(circle, renderService, drawContext, params) {
|
|
2253
|
+
const { context } = drawContext;
|
|
2254
|
+
if (!context) {
|
|
2255
|
+
return;
|
|
2256
|
+
}
|
|
2257
|
+
const canvas = context.canvas.nativeCanvas;
|
|
2258
|
+
const rc = U.canvas(canvas, {});
|
|
2259
|
+
const circleAttribute = vrender.getTheme(circle).circle;
|
|
2260
|
+
let { x = circleAttribute.x, y = circleAttribute.y } = circle.attribute;
|
|
2261
|
+
if (!circle.transMatrix.onlyTranslate()) {
|
|
2262
|
+
x = 0;
|
|
2263
|
+
y = 0;
|
|
2264
|
+
context.transformFromMatrix(circle.transMatrix, true);
|
|
2265
|
+
}
|
|
2266
|
+
else if (!context.onlyTranslate()) {
|
|
2267
|
+
context.clearMatrix();
|
|
2268
|
+
}
|
|
2269
|
+
const { radius = circleAttribute.radius, fill = circleAttribute.fill, stroke = circleAttribute.stroke, lineWidth = circleAttribute.lineWidth } = circle.attribute;
|
|
2270
|
+
rc.circle(x, y, radius, {
|
|
2271
|
+
fill: fill ? fill : undefined,
|
|
2272
|
+
stroke: stroke ? stroke : undefined,
|
|
2273
|
+
strokeWidth: lineWidth,
|
|
2274
|
+
fillStyle: 'zigzag',
|
|
2275
|
+
roughness: 0.5
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb) {
|
|
2279
|
+
if (this.canvasRenderer.drawShape) {
|
|
2280
|
+
return this.canvasRenderer.drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb);
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
};
|
|
2284
|
+
RoughCanvasCircleRender = __decorate([
|
|
2285
|
+
inversify.injectable(),
|
|
2286
|
+
__param(0, inversify.inject(vrender.DefaultCanvasCircleRender)),
|
|
2287
|
+
__metadata("design:paramtypes", [Object])
|
|
2288
|
+
], RoughCanvasCircleRender);
|
|
2289
|
+
|
|
2290
|
+
let RoughCanvasLineRender = class RoughCanvasLineRender extends vrender.DefaultCanvasLineRender {
|
|
2291
|
+
style = 'rough';
|
|
2292
|
+
drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
|
|
2293
|
+
if (fillCb || strokeCb) {
|
|
2294
|
+
return super.drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb);
|
|
2295
|
+
}
|
|
2296
|
+
context.highPerformanceSave();
|
|
2297
|
+
const canvas = context.canvas.nativeCanvas;
|
|
2298
|
+
const rc = U.canvas(canvas, {});
|
|
2299
|
+
const customPath = new vrender.CustomPath2D();
|
|
2300
|
+
vrender.drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
|
|
2301
|
+
offsetX,
|
|
2302
|
+
offsetY
|
|
2303
|
+
});
|
|
2304
|
+
const { maxRandomnessOffset = defaultRouthThemeSpec.maxRandomnessOffset, roughness = defaultRouthThemeSpec.roughness, bowing = defaultRouthThemeSpec.bowing, curveFitting = defaultRouthThemeSpec.curveFitting, curveTightness = defaultRouthThemeSpec.curveTightness, curveStepCount = defaultRouthThemeSpec.curveStepCount, fillStyle = defaultRouthThemeSpec.fillStyle, fillWeight = defaultRouthThemeSpec.fillWeight, hachureAngle = defaultRouthThemeSpec.hachureAngle, hachureGap = defaultRouthThemeSpec.hachureGap, simplification = defaultRouthThemeSpec.simplification, dashOffset = defaultRouthThemeSpec.dashOffset, dashGap = defaultRouthThemeSpec.dashGap, zigzagOffset = defaultRouthThemeSpec.zigzagOffset, seed = defaultRouthThemeSpec.seed, fillLineDash = defaultRouthThemeSpec.fillLineDash, fillLineDashOffset = defaultRouthThemeSpec.fillLineDashOffset, disableMultiStroke = defaultRouthThemeSpec.disableMultiStroke, disableMultiStrokeFill = defaultRouthThemeSpec.disableMultiStrokeFill, preserveVertices = defaultRouthThemeSpec.preserveVertices, fixedDecimalPlaceDigits = defaultRouthThemeSpec.fixedDecimalPlaceDigits } = attribute;
|
|
2305
|
+
let { fill: fillColor, stroke: strokeColor, lineWidth } = attribute;
|
|
2306
|
+
if (Array.isArray(defaultAttribute)) {
|
|
2307
|
+
defaultAttribute.forEach(item => {
|
|
2308
|
+
fillColor = fillColor ?? item.fill;
|
|
2309
|
+
strokeColor = strokeColor ?? item.stroke;
|
|
2310
|
+
lineWidth = lineWidth ?? item.lineWidth;
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
else {
|
|
2314
|
+
fillColor = fillColor ?? defaultAttribute.fill;
|
|
2315
|
+
strokeColor = strokeColor ?? defaultAttribute.stroke;
|
|
2316
|
+
lineWidth = lineWidth ?? defaultAttribute.lineWidth;
|
|
2317
|
+
}
|
|
2318
|
+
rc.path(customPath.toString(), {
|
|
2319
|
+
fill: fill ? fillColor : undefined,
|
|
2320
|
+
stroke: stroke ? strokeColor : undefined,
|
|
2321
|
+
strokeWidth: lineWidth,
|
|
2322
|
+
maxRandomnessOffset,
|
|
2323
|
+
roughness,
|
|
2324
|
+
bowing,
|
|
2325
|
+
curveFitting,
|
|
2326
|
+
curveTightness,
|
|
2327
|
+
curveStepCount,
|
|
2328
|
+
fillStyle,
|
|
2329
|
+
fillWeight,
|
|
2330
|
+
hachureAngle,
|
|
2331
|
+
hachureGap,
|
|
2332
|
+
simplification,
|
|
2333
|
+
dashOffset,
|
|
2334
|
+
dashGap,
|
|
2335
|
+
zigzagOffset,
|
|
2336
|
+
seed,
|
|
2337
|
+
fillLineDash,
|
|
2338
|
+
fillLineDashOffset,
|
|
2339
|
+
disableMultiStroke,
|
|
2340
|
+
disableMultiStrokeFill,
|
|
2341
|
+
preserveVertices,
|
|
2342
|
+
fixedDecimalPlaceDigits
|
|
2343
|
+
});
|
|
2344
|
+
context.highPerformanceRestore();
|
|
2345
|
+
return false;
|
|
2346
|
+
}
|
|
2347
|
+
};
|
|
2348
|
+
RoughCanvasLineRender = __decorate([
|
|
2349
|
+
inversify.injectable()
|
|
2350
|
+
], RoughCanvasLineRender);
|
|
2351
|
+
|
|
2352
|
+
let RoughCanvasPathRender = class RoughCanvasPathRender {
|
|
2353
|
+
canvasRenderer;
|
|
2354
|
+
type;
|
|
2355
|
+
numberType;
|
|
2356
|
+
style = 'rough';
|
|
2357
|
+
constructor(canvasRenderer) {
|
|
2358
|
+
this.canvasRenderer = canvasRenderer;
|
|
2359
|
+
this.type = 'path';
|
|
2360
|
+
this.numberType = vrender.PATH_NUMBER_TYPE;
|
|
2361
|
+
}
|
|
2362
|
+
draw(path, renderService, drawContext, params) {
|
|
2363
|
+
const { context } = drawContext;
|
|
2364
|
+
if (!context) {
|
|
2365
|
+
return;
|
|
2366
|
+
}
|
|
2367
|
+
const canvas = context.canvas.nativeCanvas;
|
|
2368
|
+
const rc = U.canvas(canvas, {});
|
|
2369
|
+
context.highPerformanceSave();
|
|
2370
|
+
const pathAttribute = vrender.getTheme(path).path;
|
|
2371
|
+
context.transformFromMatrix(path.transMatrix, true);
|
|
2372
|
+
const { fill = pathAttribute.fill, stroke = pathAttribute.stroke, lineWidth = pathAttribute.lineWidth, path: p = pathAttribute.path, maxRandomnessOffset = defaultRouthThemeSpec.maxRandomnessOffset, roughness = defaultRouthThemeSpec.roughness, bowing = defaultRouthThemeSpec.bowing, curveFitting = defaultRouthThemeSpec.curveFitting, curveTightness = defaultRouthThemeSpec.curveTightness, curveStepCount = defaultRouthThemeSpec.curveStepCount, fillStyle = defaultRouthThemeSpec.fillStyle, fillWeight = defaultRouthThemeSpec.fillWeight, hachureAngle = defaultRouthThemeSpec.hachureAngle, hachureGap = defaultRouthThemeSpec.hachureGap, simplification = defaultRouthThemeSpec.simplification, dashOffset = defaultRouthThemeSpec.dashOffset, dashGap = defaultRouthThemeSpec.dashGap, zigzagOffset = defaultRouthThemeSpec.zigzagOffset, seed = defaultRouthThemeSpec.seed, fillLineDash = defaultRouthThemeSpec.fillLineDash, fillLineDashOffset = defaultRouthThemeSpec.fillLineDashOffset, disableMultiStroke = defaultRouthThemeSpec.disableMultiStroke, disableMultiStrokeFill = defaultRouthThemeSpec.disableMultiStrokeFill, preserveVertices = defaultRouthThemeSpec.preserveVertices, fixedDecimalPlaceDigits = defaultRouthThemeSpec.fixedDecimalPlaceDigits } = path.attribute;
|
|
2373
|
+
if (typeof p === 'string') {
|
|
2374
|
+
rc.path(p, {
|
|
2375
|
+
fill: fill ? fill : undefined,
|
|
2376
|
+
stroke: stroke ? stroke : undefined,
|
|
2377
|
+
strokeWidth: lineWidth,
|
|
2378
|
+
maxRandomnessOffset,
|
|
2379
|
+
roughness,
|
|
2380
|
+
bowing,
|
|
2381
|
+
curveFitting,
|
|
2382
|
+
curveTightness,
|
|
2383
|
+
curveStepCount,
|
|
2384
|
+
fillStyle,
|
|
2385
|
+
fillWeight,
|
|
2386
|
+
hachureAngle,
|
|
2387
|
+
hachureGap,
|
|
2388
|
+
simplification,
|
|
2389
|
+
dashOffset,
|
|
2390
|
+
dashGap,
|
|
2391
|
+
zigzagOffset,
|
|
2392
|
+
seed,
|
|
2393
|
+
fillLineDash,
|
|
2394
|
+
fillLineDashOffset,
|
|
2395
|
+
disableMultiStroke,
|
|
2396
|
+
disableMultiStrokeFill,
|
|
2397
|
+
preserveVertices,
|
|
2398
|
+
fixedDecimalPlaceDigits
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
context.highPerformanceRestore();
|
|
2402
|
+
}
|
|
2403
|
+
drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb) {
|
|
2404
|
+
if (this.canvasRenderer.drawShape) {
|
|
2405
|
+
return this.canvasRenderer.drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb);
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
RoughCanvasPathRender = __decorate([
|
|
2410
|
+
inversify.injectable(),
|
|
2411
|
+
__param(0, inversify.inject(vrender.DefaultCanvasPathRender)),
|
|
2412
|
+
__metadata("design:paramtypes", [Object])
|
|
2413
|
+
], RoughCanvasPathRender);
|
|
2414
|
+
|
|
2415
|
+
let RoughCanvasRectRender = class RoughCanvasRectRender {
|
|
2416
|
+
canvasRenderer;
|
|
2417
|
+
type;
|
|
2418
|
+
numberType;
|
|
2419
|
+
style = 'rough';
|
|
2420
|
+
constructor(canvasRenderer) {
|
|
2421
|
+
this.canvasRenderer = canvasRenderer;
|
|
2422
|
+
this.type = 'rect';
|
|
2423
|
+
this.numberType = vrender.RECT_NUMBER_TYPE;
|
|
2424
|
+
}
|
|
2425
|
+
draw(rect, renderService, drawContext, params) {
|
|
2426
|
+
const { context } = drawContext;
|
|
2427
|
+
if (!context) {
|
|
2428
|
+
return;
|
|
2429
|
+
}
|
|
2430
|
+
const canvas = context.canvas.nativeCanvas;
|
|
2431
|
+
const rc = U.canvas(canvas);
|
|
2432
|
+
context.highPerformanceSave();
|
|
2433
|
+
const rectAttribute = vrender.getTheme(rect).rect;
|
|
2434
|
+
let { x = rectAttribute.x, y = rectAttribute.y } = rect.attribute;
|
|
2435
|
+
if (!rect.transMatrix.onlyTranslate()) {
|
|
2436
|
+
x = 0;
|
|
2437
|
+
y = 0;
|
|
2438
|
+
context.transformFromMatrix(rect.transMatrix, true);
|
|
2439
|
+
}
|
|
2440
|
+
else {
|
|
2441
|
+
const { dx = rectAttribute.dx, dy = rectAttribute.dy } = rect.attribute;
|
|
2442
|
+
x += dx;
|
|
2443
|
+
y += dy;
|
|
2444
|
+
context.setTransformForCurrent();
|
|
2445
|
+
}
|
|
2446
|
+
const { fill = rectAttribute.fill, stroke = rectAttribute.stroke, fillColor = rectAttribute.fill, strokeColor = rectAttribute.stroke, width = rectAttribute.width, height = rectAttribute.height, lineWidth = rectAttribute.lineWidth, maxRandomnessOffset = defaultRouthThemeSpec.maxRandomnessOffset, roughness = defaultRouthThemeSpec.roughness, bowing = defaultRouthThemeSpec.bowing, curveFitting = defaultRouthThemeSpec.curveFitting, curveTightness = defaultRouthThemeSpec.curveTightness, curveStepCount = defaultRouthThemeSpec.curveStepCount, fillStyle = defaultRouthThemeSpec.fillStyle, fillWeight = defaultRouthThemeSpec.fillWeight, hachureAngle = defaultRouthThemeSpec.hachureAngle, hachureGap = defaultRouthThemeSpec.hachureGap, simplification = defaultRouthThemeSpec.simplification, dashOffset = defaultRouthThemeSpec.dashOffset, dashGap = defaultRouthThemeSpec.dashGap, zigzagOffset = defaultRouthThemeSpec.zigzagOffset, seed = defaultRouthThemeSpec.seed, fillLineDash = defaultRouthThemeSpec.fillLineDash, fillLineDashOffset = defaultRouthThemeSpec.fillLineDashOffset, disableMultiStroke = defaultRouthThemeSpec.disableMultiStroke, disableMultiStrokeFill = defaultRouthThemeSpec.disableMultiStrokeFill, preserveVertices = defaultRouthThemeSpec.preserveVertices, fixedDecimalPlaceDigits = defaultRouthThemeSpec.fixedDecimalPlaceDigits } = rect.attribute;
|
|
2447
|
+
rc.rectangle(x, y, width, height, {
|
|
2448
|
+
fill: fill ? fillColor : undefined,
|
|
2449
|
+
stroke: stroke ? strokeColor : undefined,
|
|
2450
|
+
strokeWidth: lineWidth,
|
|
2451
|
+
maxRandomnessOffset,
|
|
2452
|
+
roughness,
|
|
2453
|
+
bowing,
|
|
2454
|
+
curveFitting,
|
|
2455
|
+
curveTightness,
|
|
2456
|
+
curveStepCount,
|
|
2457
|
+
fillStyle,
|
|
2458
|
+
fillWeight,
|
|
2459
|
+
hachureAngle,
|
|
2460
|
+
hachureGap,
|
|
2461
|
+
simplification,
|
|
2462
|
+
dashOffset,
|
|
2463
|
+
dashGap,
|
|
2464
|
+
zigzagOffset,
|
|
2465
|
+
seed,
|
|
2466
|
+
fillLineDash,
|
|
2467
|
+
fillLineDashOffset,
|
|
2468
|
+
disableMultiStroke,
|
|
2469
|
+
disableMultiStrokeFill,
|
|
2470
|
+
preserveVertices,
|
|
2471
|
+
fixedDecimalPlaceDigits
|
|
2472
|
+
});
|
|
2473
|
+
context.highPerformanceRestore();
|
|
2474
|
+
}
|
|
2475
|
+
drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb) {
|
|
2476
|
+
if (this.canvasRenderer.drawShape) {
|
|
2477
|
+
return this.canvasRenderer.drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb);
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
};
|
|
2481
|
+
RoughCanvasRectRender = __decorate([
|
|
2482
|
+
inversify.injectable(),
|
|
2483
|
+
__param(0, inversify.inject(vrender.DefaultCanvasRectRender)),
|
|
2484
|
+
__metadata("design:paramtypes", [Object])
|
|
2485
|
+
], RoughCanvasRectRender);
|
|
2486
|
+
|
|
2487
|
+
let RoughCanvasSymbolRender = class RoughCanvasSymbolRender {
|
|
2488
|
+
canvasRenderer;
|
|
2489
|
+
type;
|
|
2490
|
+
numberType;
|
|
2491
|
+
style = 'rough';
|
|
2492
|
+
constructor(canvasRenderer) {
|
|
2493
|
+
this.canvasRenderer = canvasRenderer;
|
|
2494
|
+
this.type = 'symbol';
|
|
2495
|
+
this.numberType = vrender.SYMBOL_NUMBER_TYPE;
|
|
2496
|
+
}
|
|
2497
|
+
draw(symbol, renderService, drawContext, params) {
|
|
2498
|
+
const { context } = drawContext;
|
|
2499
|
+
if (!context) {
|
|
2500
|
+
return;
|
|
2501
|
+
}
|
|
2502
|
+
const canvas = context.canvas.nativeCanvas;
|
|
2503
|
+
const rc = U.canvas(canvas);
|
|
2504
|
+
context.highPerformanceSave();
|
|
2505
|
+
const symbolAttribute = vrender.getTheme(symbol).symbol;
|
|
2506
|
+
let { x = symbolAttribute.x, y = symbolAttribute.y } = symbol.attribute;
|
|
2507
|
+
if (!symbol.transMatrix.onlyTranslate()) {
|
|
2508
|
+
x = 0;
|
|
2509
|
+
y = 0;
|
|
2510
|
+
context.transformFromMatrix(symbol.transMatrix, true);
|
|
2511
|
+
}
|
|
2512
|
+
else {
|
|
2513
|
+
const { dx = symbolAttribute.dx, dy = symbolAttribute.dy } = symbol.attribute;
|
|
2514
|
+
x += dx;
|
|
2515
|
+
y += dy;
|
|
2516
|
+
context.setTransformForCurrent();
|
|
2517
|
+
}
|
|
2518
|
+
const parsedPath = symbol.getParsedPath();
|
|
2519
|
+
if (!parsedPath) {
|
|
2520
|
+
return;
|
|
2521
|
+
}
|
|
2522
|
+
const { fill = symbolAttribute.fill, stroke = symbolAttribute.stroke, fillColor = symbolAttribute.fill, strokeColor = symbolAttribute.stroke, size = symbolAttribute.size, lineWidth = symbolAttribute.lineWidth, maxRandomnessOffset = defaultRouthThemeSpec.maxRandomnessOffset, roughness = defaultRouthThemeSpec.roughness, bowing = defaultRouthThemeSpec.bowing, curveFitting = defaultRouthThemeSpec.curveFitting, curveTightness = defaultRouthThemeSpec.curveTightness, curveStepCount = defaultRouthThemeSpec.curveStepCount, fillStyle = defaultRouthThemeSpec.fillStyle, fillWeight = defaultRouthThemeSpec.fillWeight, hachureAngle = defaultRouthThemeSpec.hachureAngle, hachureGap = defaultRouthThemeSpec.hachureGap, simplification = defaultRouthThemeSpec.simplification, dashOffset = defaultRouthThemeSpec.dashOffset, dashGap = defaultRouthThemeSpec.dashGap, zigzagOffset = defaultRouthThemeSpec.zigzagOffset, seed = defaultRouthThemeSpec.seed, fillLineDash = defaultRouthThemeSpec.fillLineDash, fillLineDashOffset = defaultRouthThemeSpec.fillLineDashOffset, disableMultiStroke = defaultRouthThemeSpec.disableMultiStroke, disableMultiStrokeFill = defaultRouthThemeSpec.disableMultiStrokeFill, preserveVertices = defaultRouthThemeSpec.preserveVertices, fixedDecimalPlaceDigits = defaultRouthThemeSpec.fixedDecimalPlaceDigits } = symbol.attribute;
|
|
2523
|
+
const customPath = new vrender.CustomPath2D();
|
|
2524
|
+
if (parsedPath.draw(customPath, size, x, y)) {
|
|
2525
|
+
customPath.closePath();
|
|
2526
|
+
}
|
|
2527
|
+
rc.path(customPath.toString(), {
|
|
2528
|
+
fill: fill ? fillColor : undefined,
|
|
2529
|
+
stroke: stroke ? strokeColor : undefined,
|
|
2530
|
+
strokeWidth: lineWidth,
|
|
2531
|
+
maxRandomnessOffset,
|
|
2532
|
+
roughness,
|
|
2533
|
+
bowing,
|
|
2534
|
+
curveFitting,
|
|
2535
|
+
curveTightness,
|
|
2536
|
+
curveStepCount,
|
|
2537
|
+
fillStyle,
|
|
2538
|
+
fillWeight,
|
|
2539
|
+
hachureAngle,
|
|
2540
|
+
hachureGap,
|
|
2541
|
+
simplification,
|
|
2542
|
+
dashOffset,
|
|
2543
|
+
dashGap,
|
|
2544
|
+
zigzagOffset,
|
|
2545
|
+
seed,
|
|
2546
|
+
fillLineDash,
|
|
2547
|
+
fillLineDashOffset,
|
|
2548
|
+
disableMultiStroke,
|
|
2549
|
+
disableMultiStrokeFill,
|
|
2550
|
+
preserveVertices,
|
|
2551
|
+
fixedDecimalPlaceDigits
|
|
2552
|
+
});
|
|
2553
|
+
context.highPerformanceRestore();
|
|
2554
|
+
}
|
|
2555
|
+
drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb) {
|
|
2556
|
+
if (this.canvasRenderer.drawShape) {
|
|
2557
|
+
return this.canvasRenderer.drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb);
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
};
|
|
2561
|
+
RoughCanvasSymbolRender = __decorate([
|
|
2562
|
+
inversify.injectable(),
|
|
2563
|
+
__param(0, inversify.inject(vrender.DefaultCanvasSymbolRender)),
|
|
2564
|
+
__metadata("design:paramtypes", [Object])
|
|
2565
|
+
], RoughCanvasSymbolRender);
|
|
2566
|
+
|
|
2567
|
+
var _roughModule = new inversify.ContainerModule((bind, unbind, isBound, rebind) => {
|
|
2568
|
+
bind(RoughCanvasCircleRender).toSelf().inSingletonScope();
|
|
2569
|
+
bind(vrender.GraphicRender).to(RoughCanvasCircleRender);
|
|
2570
|
+
bind(RoughCanvasRectRender).toSelf().inSingletonScope();
|
|
2571
|
+
bind(vrender.GraphicRender).to(RoughCanvasRectRender);
|
|
2572
|
+
bind(RoughCanvasPathRender).toSelf().inSingletonScope();
|
|
2573
|
+
bind(vrender.GraphicRender).to(RoughCanvasPathRender);
|
|
2574
|
+
bind(RoughCanvasSymbolRender).toSelf().inSingletonScope();
|
|
2575
|
+
bind(vrender.GraphicRender).to(RoughCanvasSymbolRender);
|
|
2576
|
+
bind(RoughCanvasLineRender).toSelf().inSingletonScope();
|
|
2577
|
+
bind(vrender.GraphicRender).to(RoughCanvasLineRender);
|
|
2578
|
+
bind(RoughCanvasAreaRender).toSelf().inSingletonScope();
|
|
2579
|
+
bind(vrender.GraphicRender).to(RoughCanvasAreaRender);
|
|
2580
|
+
bind(RoughCanvasArcRender).toSelf().inSingletonScope();
|
|
2581
|
+
bind(vrender.GraphicRender).to(RoughCanvasArcRender);
|
|
2582
|
+
});
|
|
2583
|
+
|
|
2584
|
+
const roughModule = _roughModule;
|
|
2585
|
+
|
|
2586
|
+
exports.roughModule = roughModule;
|
|
2587
|
+
|
|
2588
|
+
}));
|