Socket
Socket
Sign inDemoInstall

perfect-freehand

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

perfect-freehand - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

2

dist/cjs/index.js

@@ -1,1 +0,1 @@

function b(e,t){return[e[0]+t[0],e[1]+t[1]]}function d(e,t){return[e[0]-t[0],e[1]-t[1]]}function J(e,t){return[t[0]-e[0],t[1]-e[1]]}function p(e,t){return[e[0]*t,e[1]*t]}function be(e,t){return[e[0]/t,e[1]/t]}function E(e){return[e[1],-e[0]]}function me(e,t){return e[0]*t[0]+e[1]*t[1]}function de(e){return Math.hypot(e[0],e[1])}function he(e){return e[0]*e[0]+e[1]*e[1]}function ee(e,t){return he(d(e,t))}function I(e){return be(e,de(e))}function W(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function ae(e,t){return p(b(e,t),.5)}function C(e,t,n){let c=Math.sin(n),i=Math.cos(n),P=e[0]-t[0],h=e[1]-t[1],O=P*i-h*c,q=P*c+h*i;return[O+t[0],q+t[1]]}function w(e,t,n){return b(e,p(J(e,t),n))}function F(e,t){return e[0]===t[0]&&e[1]===t[1]}function le(e,t,n){return e*(1-n)+t*n}function te(e,t,n){return Math.max(t,Math.min(n,e))}function ve(e){return Array.isArray(e[0])?e.map(([t,n,c=.5])=>[t,n,c]):e.map(({x:t,y:n,pressure:c=.5})=>[t,n,c])}function X(e,t,n,c=.5){return t?(c=te(n(c),0,1),(t<0?le(e,e+e*te(t,-.95,-.05),c):le(e-e*te(t,.05,.95),e,c))/2):e/2}var{min:ne,PI:N}=Math;function xe(e,t={}){let{streamline:n=.5}=t,{simulatePressure:c=!0}=t;n=n/(c?4:2);let i=ve(e);if(i.length===0)return[];i.length===1&&i.push([...b(i[0],[1,1]),i[0][2]]);let P=[{point:[i[0][0],i[0][1]],pressure:i[0][2],vector:[0,0],distance:0,runningLength:0}];for(let h=1,O=0,q=i[h],M=P[O];h<i.length;h++,q=i[h],M=P[O]){let L=w(M.point,q,1-n);if(F(M.point,L))continue;let Y=I(d(M.point,L)),S=W(L,M.point),Z=M.runningLength+S,_={point:L,pressure:q[2],vector:Y,distance:S,runningLength:Z};P.push(_),O+=1}return P}function ge(e,t={}){let{size:n=8,thinning:c=.5,smoothing:i=.5,simulatePressure:P=!0,easing:h=u=>u,start:O={},end:q={},last:M=!1}=t,{streamline:L=.5}=t;L/=2;let{cap:Y=!0,taper:S=0,easing:Z=u=>u*(2-u)}=O,{cap:_=!0,taper:R=0,easing:fe=u=>--u*u*u+1}=q,V=e.length;if(V===0)return[];let re=e[V-1].runningLength,v=[],g=[],$=e.slice(0,5).reduce((u,y)=>(u+y.pressure)/2,e[0].pressure),k=X(n,c,h,e[V-1].pressure),ue,oe=e[0].vector,j=e[0].point,G=j,a=j,m=G,Q=!0;for(let u=0;u<V-1;u++){let{pressure:y}=e[u],{point:l,vector:o,distance:f,runningLength:r}=e[u];if(u>0&&Q&&r<n/2)continue;if(Q&&(Q=!1),c){if(P){let U=ne(1,1-f/n),D=ne(1,f/n);y=ne(1,$+(U-$)*(D/2))}k=X(n,c,h,y)}else k=n/2;ue===void 0&&(ue=k);let s=r<S?Z(r/S):1,H=re-r<R?fe((re-r)/R):1;k=Math.max(.01,k*Math.min(s,H));let se=e[u+1].vector,A=me(o,se);if(A<0){let U=p(E(oe),k);for(let D=0;D<1;D+=.2)m=C(b(l,U),l,N*-D),a=C(d(l,U),l,N*D),g.push(m),v.push(a);j=a,G=m;continue}let ce=p(E(w(se,o,A)),k);a=d(l,ce),m=b(l,ce);let ie=u<2||A<.25,pe=Math.pow(Math.max((r>n?n:n/2)*i,1),2);(ie||ee(j,a)>pe)&&(v.push(w(j,a,L)),j=a),(ie||ee(G,m)>pe)&&(g.push(w(G,m,L)),G=m),$=y,oe=o}let x=e[0],B=e[V-1],z=Q||g.length<2||v.length<2;if(z&&(!(S||R)||M)){let u=0;for(let o=0;o<V;o++){let{pressure:f,runningLength:r}=e[o];if(r>n){u=X(n,c,h,f);break}}let y=d(x.point,p(E(I(J(B.point,x.point))),u||k)),l=[];for(let o=0,f=.1;o<=1;o+=f)l.push(C(y,x.point,N*2*o));return l}let K=[],T=[];if(v.length>1&&g.length>1){m=g[1];for(let r=1;r<v.length;r++)if(!F(m,v[r])){a=v[r];break}if(Y||S)if(!S&&!(R&&z)){if(!F(m,a)){let r=d(x.point,p(I(J(m,a)),W(m,a)/2));for(let s=0,H=.1;s<=1;s+=H)K.push(C(r,x.point,N*s));v.shift(),g.shift()}}else K.push(x.point,b(x.point,[.1,.1]));else if(!F(m,a)){let r=I(J(m,a)),s=W(m,a)/2;K.push(d(x.point,p(r,s*.95))),K.push(d(x.point,p(r,s))),K.push(b(x.point,p(r,s))),K.push(b(x.point,p(r,s*.95))),v.shift(),g.shift()}let u=v[v.length-1],y=g[g.length-1],l=ae(u,y),o=t.last?B.point:w(l,B.point,.618),f=I(d(o,l));if(_||R)if(!R&&!(S&&z)){let r=b(o,p(E(f),k));for(let s=0,H=.15;s<=1;s+=H)T.push(C(r,o,N*3*s))}else T.push(o);else{let r=w(l,o,.95),s=k*.95;T.push(b(r,p(E(f),s))),T.push(b(o,p(E(f),s))),T.push(d(o,p(E(f),s))),T.push(d(r,p(E(f),s)))}}return v.concat(T,g.reverse(),K)}function ke(e,t={}){return ge(xe(e,t),t)}export{ke as default,ge as getStrokeOutlinePoints,xe as getStrokePoints};
var me=Object.defineProperty;var ge=e=>me(e,"__esModule",{value:!0});var ke=(e,t)=>{ge(e);for(var n in t)me(e,n,{get:t[n],enumerable:!0})};ke(exports,{default:()=>he,getStrokeOutlinePoints:()=>de,getStrokePoints:()=>be});function b(e,t){return[e[0]+t[0],e[1]+t[1]]}function d(e,t){return[e[0]-t[0],e[1]-t[1]]}function J(e,t){return[t[0]-e[0],t[1]-e[1]]}function p(e,t){return[e[0]*t,e[1]*t]}function Pe(e,t){return[e[0]/t,e[1]/t]}function E(e){return[e[1],-e[0]]}function ae(e,t){return e[0]*t[0]+e[1]*t[1]}function Se(e){return Math.hypot(e[0],e[1])}function ye(e){return e[0]*e[0]+e[1]*e[1]}function ee(e,t){return ye(d(e,t))}function I(e){return Pe(e,Se(e))}function W(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function le(e,t){return p(b(e,t),.5)}function C(e,t,n){let c=Math.sin(n),i=Math.cos(n),P=e[0]-t[0],h=e[1]-t[1],O=P*i-h*c,q=P*c+h*i;return[O+t[0],q+t[1]]}function w(e,t,n){return b(e,p(J(e,t),n))}function F(e,t){return e[0]===t[0]&&e[1]===t[1]}function ve(e,t,n){return e*(1-n)+t*n}function te(e,t,n){return Math.max(t,Math.min(n,e))}function fe(e){return Array.isArray(e[0])?e.map(([t,n,c=.5])=>[t,n,c]):e.map(({x:t,y:n,pressure:c=.5})=>[t,n,c])}function X(e,t,n,c=.5){return t?(c=te(n(c),0,1),(t<0?ve(e,e+e*te(t,-.95,-.05),c):ve(e-e*te(t,.05,.95),e,c))/2):e/2}var{min:ne,PI:N}=Math;function be(e,t={}){let{streamline:n=.5}=t,{simulatePressure:c=!0}=t;n=n/(c?4:2);let i=fe(e);if(i.length===0)return[];i.length===1&&i.push([...b(i[0],[1,1]),i[0][2]]);let P=[{point:[i[0][0],i[0][1]],pressure:i[0][2],vector:[0,0],distance:0,runningLength:0}];for(let h=1,O=0,q=i[h],M=P[O];h<i.length;h++,q=i[h],M=P[O]){let L=w(M.point,q,1-n);if(F(M.point,L))continue;let Y=I(d(M.point,L)),S=W(L,M.point),Z=M.runningLength+S,_={point:L,pressure:q[2],vector:Y,distance:S,runningLength:Z};P.push(_),O+=1}return P}function de(e,t={}){let{size:n=8,thinning:c=.5,smoothing:i=.5,simulatePressure:P=!0,easing:h=u=>u,start:O={},end:q={},last:M=!1}=t,{streamline:L=.5}=t;L/=2;let{cap:Y=!0,taper:S=0,easing:Z=u=>u*(2-u)}=O,{cap:_=!0,taper:R=0,easing:xe=u=>--u*u*u+1}=q,V=e.length;if(V===0)return[];let re=e[V-1].runningLength,v=[],g=[],$=e.slice(0,5).reduce((u,y)=>(u+y.pressure)/2,e[0].pressure),k=X(n,c,h,e[V-1].pressure),ue,oe=e[0].vector,j=e[0].point,G=j,a=j,m=G,Q=!0;for(let u=0;u<V-1;u++){let{pressure:y}=e[u],{point:l,vector:o,distance:f,runningLength:r}=e[u];if(u>0&&Q&&r<n/2)continue;if(Q&&(Q=!1),c){if(P){let U=ne(1,1-f/n),D=ne(1,f/n);y=ne(1,$+(U-$)*(D/2))}k=X(n,c,h,y)}else k=n/2;ue===void 0&&(ue=k);let s=r<S?Z(r/S):1,H=re-r<R?xe((re-r)/R):1;k=Math.max(.01,k*Math.min(s,H));let se=e[u+1].vector,A=ae(o,se);if(A<0){let U=p(E(oe),k);for(let D=0;D<1;D+=.2)m=C(b(l,U),l,N*-D),a=C(d(l,U),l,N*D),g.push(m),v.push(a);j=a,G=m;continue}let ce=p(E(w(se,o,A)),k);a=d(l,ce),m=b(l,ce);let ie=u<2||A<.25,pe=Math.pow(Math.max((r>n?n:n/2)*i,1),2);(ie||ee(j,a)>pe)&&(v.push(w(j,a,L)),j=a),(ie||ee(G,m)>pe)&&(g.push(w(G,m,L)),G=m),$=y,oe=o}let x=e[0],B=e[V-1],z=Q||g.length<2||v.length<2;if(z&&(!(S||R)||M)){let u=0;for(let o=0;o<V;o++){let{pressure:f,runningLength:r}=e[o];if(r>n){u=X(n,c,h,f);break}}let y=d(x.point,p(E(I(J(B.point,x.point))),u||k)),l=[];for(let o=0,f=.1;o<=1;o+=f)l.push(C(y,x.point,N*2*o));return l}let K=[],T=[];if(v.length>1&&g.length>1){m=g[1];for(let r=1;r<v.length;r++)if(!F(m,v[r])){a=v[r];break}if(Y||S)if(!S&&!(R&&z)){if(!F(m,a)){let r=d(x.point,p(I(J(m,a)),W(m,a)/2));for(let s=0,H=.1;s<=1;s+=H)K.push(C(r,x.point,N*s));v.shift(),g.shift()}}else K.push(x.point,b(x.point,[.1,.1]));else if(!F(m,a)){let r=I(J(m,a)),s=W(m,a)/2;K.push(d(x.point,p(r,s*.95))),K.push(d(x.point,p(r,s))),K.push(b(x.point,p(r,s))),K.push(b(x.point,p(r,s*.95))),v.shift(),g.shift()}let u=v[v.length-1],y=g[g.length-1],l=le(u,y),o=t.last?B.point:w(l,B.point,.618),f=I(d(o,l));if(_||R)if(!R&&!(S&&z)){let r=b(o,p(E(f),k));for(let s=0,H=.15;s<=1;s+=H)T.push(C(r,o,N*3*s))}else T.push(o);else{let r=w(l,o,.95),s=k*.95;T.push(b(r,p(E(f),s))),T.push(b(o,p(E(f),s))),T.push(d(o,p(E(f),s))),T.push(d(r,p(E(f),s)))}}return v.concat(T,g.reverse(),K)}function he(e,t={}){return de(be(e,t),t)}

@@ -1,1 +0,1 @@

var me=Object.defineProperty;var ge=e=>me(e,"__esModule",{value:!0});var ke=(e,t)=>{ge(e);for(var n in t)me(e,n,{get:t[n],enumerable:!0})};ke(exports,{default:()=>he,getStrokeOutlinePoints:()=>de,getStrokePoints:()=>be});function b(e,t){return[e[0]+t[0],e[1]+t[1]]}function d(e,t){return[e[0]-t[0],e[1]-t[1]]}function J(e,t){return[t[0]-e[0],t[1]-e[1]]}function p(e,t){return[e[0]*t,e[1]*t]}function Pe(e,t){return[e[0]/t,e[1]/t]}function E(e){return[e[1],-e[0]]}function ae(e,t){return e[0]*t[0]+e[1]*t[1]}function Se(e){return Math.hypot(e[0],e[1])}function ye(e){return e[0]*e[0]+e[1]*e[1]}function ee(e,t){return ye(d(e,t))}function I(e){return Pe(e,Se(e))}function W(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function le(e,t){return p(b(e,t),.5)}function C(e,t,n){let c=Math.sin(n),i=Math.cos(n),P=e[0]-t[0],h=e[1]-t[1],O=P*i-h*c,q=P*c+h*i;return[O+t[0],q+t[1]]}function w(e,t,n){return b(e,p(J(e,t),n))}function F(e,t){return e[0]===t[0]&&e[1]===t[1]}function ve(e,t,n){return e*(1-n)+t*n}function te(e,t,n){return Math.max(t,Math.min(n,e))}function fe(e){return Array.isArray(e[0])?e.map(([t,n,c=.5])=>[t,n,c]):e.map(({x:t,y:n,pressure:c=.5})=>[t,n,c])}function X(e,t,n,c=.5){return t?(c=te(n(c),0,1),(t<0?ve(e,e+e*te(t,-.95,-.05),c):ve(e-e*te(t,.05,.95),e,c))/2):e/2}var{min:ne,PI:N}=Math;function be(e,t={}){let{streamline:n=.5}=t,{simulatePressure:c=!0}=t;n=n/(c?4:2);let i=fe(e);if(i.length===0)return[];i.length===1&&i.push([...b(i[0],[1,1]),i[0][2]]);let P=[{point:[i[0][0],i[0][1]],pressure:i[0][2],vector:[0,0],distance:0,runningLength:0}];for(let h=1,O=0,q=i[h],M=P[O];h<i.length;h++,q=i[h],M=P[O]){let L=w(M.point,q,1-n);if(F(M.point,L))continue;let Y=I(d(M.point,L)),S=W(L,M.point),Z=M.runningLength+S,_={point:L,pressure:q[2],vector:Y,distance:S,runningLength:Z};P.push(_),O+=1}return P}function de(e,t={}){let{size:n=8,thinning:c=.5,smoothing:i=.5,simulatePressure:P=!0,easing:h=u=>u,start:O={},end:q={},last:M=!1}=t,{streamline:L=.5}=t;L/=2;let{cap:Y=!0,taper:S=0,easing:Z=u=>u*(2-u)}=O,{cap:_=!0,taper:R=0,easing:xe=u=>--u*u*u+1}=q,V=e.length;if(V===0)return[];let re=e[V-1].runningLength,v=[],g=[],$=e.slice(0,5).reduce((u,y)=>(u+y.pressure)/2,e[0].pressure),k=X(n,c,h,e[V-1].pressure),ue,oe=e[0].vector,j=e[0].point,G=j,a=j,m=G,Q=!0;for(let u=0;u<V-1;u++){let{pressure:y}=e[u],{point:l,vector:o,distance:f,runningLength:r}=e[u];if(u>0&&Q&&r<n/2)continue;if(Q&&(Q=!1),c){if(P){let U=ne(1,1-f/n),D=ne(1,f/n);y=ne(1,$+(U-$)*(D/2))}k=X(n,c,h,y)}else k=n/2;ue===void 0&&(ue=k);let s=r<S?Z(r/S):1,H=re-r<R?xe((re-r)/R):1;k=Math.max(.01,k*Math.min(s,H));let se=e[u+1].vector,A=ae(o,se);if(A<0){let U=p(E(oe),k);for(let D=0;D<1;D+=.2)m=C(b(l,U),l,N*-D),a=C(d(l,U),l,N*D),g.push(m),v.push(a);j=a,G=m;continue}let ce=p(E(w(se,o,A)),k);a=d(l,ce),m=b(l,ce);let ie=u<2||A<.25,pe=Math.pow(Math.max((r>n?n:n/2)*i,1),2);(ie||ee(j,a)>pe)&&(v.push(w(j,a,L)),j=a),(ie||ee(G,m)>pe)&&(g.push(w(G,m,L)),G=m),$=y,oe=o}let x=e[0],B=e[V-1],z=Q||g.length<2||v.length<2;if(z&&(!(S||R)||M)){let u=0;for(let o=0;o<V;o++){let{pressure:f,runningLength:r}=e[o];if(r>n){u=X(n,c,h,f);break}}let y=d(x.point,p(E(I(J(B.point,x.point))),u||k)),l=[];for(let o=0,f=.1;o<=1;o+=f)l.push(C(y,x.point,N*2*o));return l}let K=[],T=[];if(v.length>1&&g.length>1){m=g[1];for(let r=1;r<v.length;r++)if(!F(m,v[r])){a=v[r];break}if(Y||S)if(!S&&!(R&&z)){if(!F(m,a)){let r=d(x.point,p(I(J(m,a)),W(m,a)/2));for(let s=0,H=.1;s<=1;s+=H)K.push(C(r,x.point,N*s));v.shift(),g.shift()}}else K.push(x.point,b(x.point,[.1,.1]));else if(!F(m,a)){let r=I(J(m,a)),s=W(m,a)/2;K.push(d(x.point,p(r,s*.95))),K.push(d(x.point,p(r,s))),K.push(b(x.point,p(r,s))),K.push(b(x.point,p(r,s*.95))),v.shift(),g.shift()}let u=v[v.length-1],y=g[g.length-1],l=le(u,y),o=t.last?B.point:w(l,B.point,.618),f=I(d(o,l));if(_||R)if(!R&&!(S&&z)){let r=b(o,p(E(f),k));for(let s=0,H=.15;s<=1;s+=H)T.push(C(r,o,N*3*s))}else T.push(o);else{let r=w(l,o,.95),s=k*.95;T.push(b(r,p(E(f),s))),T.push(b(o,p(E(f),s))),T.push(d(o,p(E(f),s))),T.push(d(r,p(E(f),s)))}}return v.concat(T,g.reverse(),K)}function he(e,t={}){return de(be(e,t),t)}
function b(e,t){return[e[0]+t[0],e[1]+t[1]]}function d(e,t){return[e[0]-t[0],e[1]-t[1]]}function J(e,t){return[t[0]-e[0],t[1]-e[1]]}function p(e,t){return[e[0]*t,e[1]*t]}function be(e,t){return[e[0]/t,e[1]/t]}function E(e){return[e[1],-e[0]]}function me(e,t){return e[0]*t[0]+e[1]*t[1]}function de(e){return Math.hypot(e[0],e[1])}function he(e){return e[0]*e[0]+e[1]*e[1]}function ee(e,t){return he(d(e,t))}function I(e){return be(e,de(e))}function W(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function ae(e,t){return p(b(e,t),.5)}function C(e,t,n){let c=Math.sin(n),i=Math.cos(n),P=e[0]-t[0],h=e[1]-t[1],O=P*i-h*c,q=P*c+h*i;return[O+t[0],q+t[1]]}function w(e,t,n){return b(e,p(J(e,t),n))}function F(e,t){return e[0]===t[0]&&e[1]===t[1]}function le(e,t,n){return e*(1-n)+t*n}function te(e,t,n){return Math.max(t,Math.min(n,e))}function ve(e){return Array.isArray(e[0])?e.map(([t,n,c=.5])=>[t,n,c]):e.map(({x:t,y:n,pressure:c=.5})=>[t,n,c])}function X(e,t,n,c=.5){return t?(c=te(n(c),0,1),(t<0?le(e,e+e*te(t,-.95,-.05),c):le(e-e*te(t,.05,.95),e,c))/2):e/2}var{min:ne,PI:N}=Math;function xe(e,t={}){let{streamline:n=.5}=t,{simulatePressure:c=!0}=t;n=n/(c?4:2);let i=ve(e);if(i.length===0)return[];i.length===1&&i.push([...b(i[0],[1,1]),i[0][2]]);let P=[{point:[i[0][0],i[0][1]],pressure:i[0][2],vector:[0,0],distance:0,runningLength:0}];for(let h=1,O=0,q=i[h],M=P[O];h<i.length;h++,q=i[h],M=P[O]){let L=w(M.point,q,1-n);if(F(M.point,L))continue;let Y=I(d(M.point,L)),S=W(L,M.point),Z=M.runningLength+S,_={point:L,pressure:q[2],vector:Y,distance:S,runningLength:Z};P.push(_),O+=1}return P}function ge(e,t={}){let{size:n=8,thinning:c=.5,smoothing:i=.5,simulatePressure:P=!0,easing:h=u=>u,start:O={},end:q={},last:M=!1}=t,{streamline:L=.5}=t;L/=2;let{cap:Y=!0,taper:S=0,easing:Z=u=>u*(2-u)}=O,{cap:_=!0,taper:R=0,easing:fe=u=>--u*u*u+1}=q,V=e.length;if(V===0)return[];let re=e[V-1].runningLength,v=[],g=[],$=e.slice(0,5).reduce((u,y)=>(u+y.pressure)/2,e[0].pressure),k=X(n,c,h,e[V-1].pressure),ue,oe=e[0].vector,j=e[0].point,G=j,a=j,m=G,Q=!0;for(let u=0;u<V-1;u++){let{pressure:y}=e[u],{point:l,vector:o,distance:f,runningLength:r}=e[u];if(u>0&&Q&&r<n/2)continue;if(Q&&(Q=!1),c){if(P){let U=ne(1,1-f/n),D=ne(1,f/n);y=ne(1,$+(U-$)*(D/2))}k=X(n,c,h,y)}else k=n/2;ue===void 0&&(ue=k);let s=r<S?Z(r/S):1,H=re-r<R?fe((re-r)/R):1;k=Math.max(.01,k*Math.min(s,H));let se=e[u+1].vector,A=me(o,se);if(A<0){let U=p(E(oe),k);for(let D=0;D<1;D+=.2)m=C(b(l,U),l,N*-D),a=C(d(l,U),l,N*D),g.push(m),v.push(a);j=a,G=m;continue}let ce=p(E(w(se,o,A)),k);a=d(l,ce),m=b(l,ce);let ie=u<2||A<.25,pe=Math.pow(Math.max((r>n?n:n/2)*i,1),2);(ie||ee(j,a)>pe)&&(v.push(w(j,a,L)),j=a),(ie||ee(G,m)>pe)&&(g.push(w(G,m,L)),G=m),$=y,oe=o}let x=e[0],B=e[V-1],z=Q||g.length<2||v.length<2;if(z&&(!(S||R)||M)){let u=0;for(let o=0;o<V;o++){let{pressure:f,runningLength:r}=e[o];if(r>n){u=X(n,c,h,f);break}}let y=d(x.point,p(E(I(J(B.point,x.point))),u||k)),l=[];for(let o=0,f=.1;o<=1;o+=f)l.push(C(y,x.point,N*2*o));return l}let K=[],T=[];if(v.length>1&&g.length>1){m=g[1];for(let r=1;r<v.length;r++)if(!F(m,v[r])){a=v[r];break}if(Y||S)if(!S&&!(R&&z)){if(!F(m,a)){let r=d(x.point,p(I(J(m,a)),W(m,a)/2));for(let s=0,H=.1;s<=1;s+=H)K.push(C(r,x.point,N*s));v.shift(),g.shift()}}else K.push(x.point,b(x.point,[.1,.1]));else if(!F(m,a)){let r=I(J(m,a)),s=W(m,a)/2;K.push(d(x.point,p(r,s*.95))),K.push(d(x.point,p(r,s))),K.push(b(x.point,p(r,s))),K.push(b(x.point,p(r,s*.95))),v.shift(),g.shift()}let u=v[v.length-1],y=g[g.length-1],l=ae(u,y),o=t.last?B.point:w(l,B.point,.618),f=I(d(o,l));if(_||R)if(!R&&!(S&&z)){let r=b(o,p(E(f),k));for(let s=0,H=.15;s<=1;s+=H)T.push(C(r,o,N*3*s))}else T.push(o);else{let r=w(l,o,.95),s=k*.95;T.push(b(r,p(E(f),s))),T.push(b(o,p(E(f),s))),T.push(d(o,p(E(f),s))),T.push(d(r,p(E(f),s)))}}return v.concat(T,g.reverse(),K)}function ke(e,t={}){return ge(xe(e,t),t)}export{ke as default,ge as getStrokeOutlinePoints,xe as getStrokePoints};
{
"version": "0.5.1",
"version": "0.5.2",
"name": "perfect-freehand",

@@ -25,2 +25,3 @@ "private": false,

"types": "./dist/types/index.d.ts",
"typings": "./dist/types/index.d.ts",
"scripts": {

@@ -48,3 +49,3 @@ "start": "node scripts/dev & tsc --watch --incremental --emitDeclarationOnly --declarationMap --outDir dist/types",

},
"gitHead": "d7e9d7ee6ccc383a542385af78f4583963740eec"
"gitHead": "c13ecc2363bcd33a72f3c49cf72496794f2cc726"
}

@@ -11,3 +11,3 @@ /* eslint-disable */

entryPoints: ['./src/index.ts'],
outdir: 'dist/esm',
outdir: 'dist/cjs',
minify: true,

@@ -22,3 +22,3 @@ bundle: true,

entryPoints: ['./src/index.ts'],
outdir: 'dist/cjs',
outdir: 'dist/esm',
minify: true,

@@ -25,0 +25,0 @@ bundle: true,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc