perfect-arrows
Advanced tools
Comparing version 0.3.4 to 0.3.5
@@ -0,1 +1,5 @@ | ||
# 0.3.5 | ||
- Reduces precision to fix bug on angles. | ||
# 0.3.4 | ||
@@ -2,0 +6,0 @@ |
@@ -617,14 +617,15 @@ 'use strict'; | ||
var finalAngle0 = overlapEffect >= 0.5 ? (PI2 + (angle + PI$1 * rot)) % PI2 : (PI2 + (angle + Math.max(MIN_ANGLE, combinedOffset) * rot)) % PI2; // Deltas of starting angle | ||
var finalAngle0 = overlapEffect >= 0.5 ? angle + PI$1 * rot : angle + Math.max(MIN_ANGLE, combinedOffset) * rot; // Deltas of starting angle | ||
var _getDelta = getDelta(finalAngle0), | ||
var _getDelta = getDelta(+(finalAngle0 % PI2).toPrecision(3)), | ||
dx0 = _getDelta[0], | ||
dy0 = _getDelta[1]; | ||
dy0 = _getDelta[1]; // Get ray intersection with rounded rectangle | ||
var intersectionsA = getRayRoundedRectangleIntersection(cx0, cy0, dx0, dy0, px0, py0, pw0, ph0, padStart); // Get ray intersection with rounded rectangle | ||
var _intersectionsA$ = intersectionsA[0], | ||
tsx = _intersectionsA$[0], | ||
tsy = _intersectionsA$[1]; // Get midpoint of startingintersected segment | ||
var _getRayRoundedRectang = getRayRoundedRectangleIntersection(cx0, cy0, dx0, dy0, px0, py0, pw0, ph0, padStart), | ||
_getRayRoundedRectang2 = _getRayRoundedRectang[0], | ||
tsx = _getRayRoundedRectang2[0], | ||
tsy = _getRayRoundedRectang2[1]; // Get midpoint of startingintersected segment | ||
var startSeg = getRectangleSegmentIntersectedByRay(px0, py0, pw0, ph0, cx0, cy0, dx0, dy0); | ||
@@ -662,7 +663,7 @@ if (!startSeg) throw Error; // Find start point (quarter way between segment midpoint and ray intersection) | ||
var _getRayRoundedRectang = getRayRoundedRectangleIntersection(cx1, cy1, dx1, dy1, px1, py1, pw1, ph1, padEnd); | ||
var _getRayRoundedRectang3 = getRayRoundedRectangleIntersection(cx1, cy1, dx1, dy1, px1, py1, pw1, ph1, padEnd); | ||
var _getRayRoundedRectang2 = _getRayRoundedRectang[0]; | ||
ex = _getRayRoundedRectang2[0]; | ||
ey = _getRayRoundedRectang2[1]; | ||
var _getRayRoundedRectang4 = _getRayRoundedRectang3[0]; | ||
ex = _getRayRoundedRectang4[0]; | ||
ey = _getRayRoundedRectang4[1]; | ||
} else { | ||
@@ -676,5 +677,5 @@ // Calculate an angle based on distance, overlap and intermediacy | ||
var finalAngle1 = overlapEffect >= 0.5 ? (PI2 + (angle + PI$1 * rot)) % PI2 : (PI2 + (angle + Math.max(MIN_ANGLE, _combinedOffset) * rot)) % PI2; // Deltas of ending angle | ||
var finalAngle1 = overlapEffect >= 0.5 ? angle + PI$1 * rot : angle + PI$1 - Math.max(_combinedOffset, MIN_ANGLE) * rot; // Deltas of ending angle | ||
var _getDelta3 = getDelta(finalAngle1), | ||
var _getDelta3 = getDelta(+(finalAngle1 % PI2).toPrecision(3)), | ||
_dx = _getDelta3[0], | ||
@@ -684,6 +685,6 @@ _dy = _getDelta3[1]; // Get ray intersection with ending rounded rectangle | ||
var _getRayRoundedRectang3 = getRayRoundedRectangleIntersection(cx1, cy1, _dx, _dy, px1, py1, pw1, ph1, padEnd), | ||
_getRayRoundedRectang4 = _getRayRoundedRectang3[0], | ||
tex = _getRayRoundedRectang4[0], | ||
tey = _getRayRoundedRectang4[1]; // Get midpoint of ending intersected segment | ||
var _getRayRoundedRectang5 = getRayRoundedRectangleIntersection(cx1, cy1, _dx, _dy, px1, py1, pw1, ph1, padEnd), | ||
_getRayRoundedRectang6 = _getRayRoundedRectang5[0], | ||
tex = _getRayRoundedRectang6[0], | ||
tey = _getRayRoundedRectang6[1]; // Get midpoint of ending intersected segment | ||
@@ -690,0 +691,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=Math.PI;function r(t,r,n,a){void 0===a&&(a=!1);var i=r[0],o=n[0],u=n[1],e=o+(t-i)/(r[1]-i)*(u-o);if(!0===a)if(o<u){if(e<o)return o;if(e>u)return u}else{if(e>o)return o;if(e<u)return u}return e}function n(t,r,n,a,i){var o=Math.sin(i),u=Math.cos(i),e=t-n,h=r-a;return[e*u-h*o+n,e*o+h*u+a]}function a(t,r,n,a){return Math.hypot(a-r,n-t)}function i(t,r,n,a){return Math.atan2(a-r,n-t)}function o(t,r,n,a){return[Math.cos(n)*a+t,Math.sin(n)*a+r]}function u(t,r,n,a,i){return void 0===i&&(i=.5),[t+(n-t)*i,r+(a-r)*i]}function e(r,n){return void 0===n&&(n=8),Math.floor(n*(.5+r/(2*t)%n))}function h(r){return r-2*t*Math.floor(r/(2*t))}function f(t,r,n,a,i,o,u,e){var h,f,v;if(a*(u-i)!=n*(e-o)&&0!=(v=n*(e-o)-a*(u-i))&&(f=((r-o)*n-(t-i)*a)/v,(h=((r-o)*(u-i)-(t-i)*(e-o))/v)>=0&&f>=0&&f<=1))return[t+h*n,r+h*a]}function v(t){return[Math.cos(t),Math.sin(t)]}function M(t,r,n,a,o,u,e,v,M){var c=o+e,s=u+v,d=o+M-1,x=u+M-1,m=o+e-M+1,p=u+v-M+1,I=[[d,x,Math.PI,1.5*Math.PI],[m,x,1.5*Math.PI,2*Math.PI],[m,p,0,.5*Math.PI],[d,p,.5*Math.PI,Math.PI]],P=[];return[[o,p,o,x],[d,u,m,u],[c,x,c,p],[m,s,d,s]].forEach((function(o,u){var e=o[0],v=o[1],c=o[2],s=o[3],d=I[u],x=d[0],m=d[1],p=d[2],l=d[3],b=function(t,r,n,a,i,o,u){return function(t,r,n,a,i,o,u){var e,h,f,v,M,c,s,d,x=[o-a,u-i],m=[a-t,i-r];return e=x[0]*m[0]+x[1]*m[1],h=2*(x[0]*x[0]+x[1]*x[1]),e*=-2,f=Math.sqrt(e*e-2*h*(m[0]*m[0]+m[1]*m[1]-n*n)),isNaN(f)?[]:(M=(e+f)/h,s=[],d=[],c=[],(v=(e-f)/h)<=1&&v>=0&&(s[0]=a+x[0]*v,s[1]=i+x[1]*v,c[0]=s),M<=1&&M>=0&&(d[0]=a+x[0]*M,d[1]=i+x[1]*M,c[c.length]=d),c)}(t,r,n,a,i,999999*o,999999*u)}(x,m,M,t,r,n,a);b&&b.filter((function(t){var r=h(i(x,m,t[0],t[1]));return r>p&&r<l})).forEach((function(t){return P.push(t)}));var w=f(t,r,n,a,e,v,c,s);w&&P.push(w)})),P}function c(t,r,n,a,i,o,u,e){return function(t,r,n,a){return[[t,r,t+n,r],[t+n,r,t+n,r+a],[t+n,r+a,t,r+a],[t,r+a,t,r]]}(t,r,n,a).find((function(t){return f(i,o,u,e,t[0],t[1],t[2],t[3])}))}var s=Math.PI,d=2*s,x=s/24;exports.getArrow=function(t,h,f,v,M){void 0===M&&(M={});var c=M.bow,s=void 0===c?0:c,d=M.stretch,x=void 0===d?.5:d,m=M.stretchMin,p=void 0===m?0:m,I=M.stretchMax,P=void 0===I?420:I,l=M.padStart,b=void 0===l?0:l,w=M.padEnd,E=void 0===w?0:w,g=M.flip,y=void 0!==g&&g,A=M.straights,B=void 0===A||A,N=i(t,h,f,v),S=a(t,h,f,v),_=function(t,r,n,a){return Math.abs((n-t)/2/((a-r)/2))}(t,h,f,v);if(S<2*(b+E)||0===s&&0===x||B&&[0,1,Infinity].includes(_)){var j=Math.max(0,Math.min(S-b,b)),q=Math.max(0,Math.min(S-j,E)),O=o(t,h,N,j),T=O[0],k=O[1],z=o(f,v,N+Math.PI,q),C=z[0],D=z[1],F=u(T,k,C,D,.5);return[T,k,F[0],F[1],C,D,N,N,N]}var G=(e(N)%2==0?1:-1)*(y?-1:1),H=s+r(S,[p,P],[1,0],!0)*x,J=u(t,h,f,v,.5),K=J[0],L=J[1],Q=u(t,h,f,v,.5-H),R=Q[0],U=Q[1],V=n(R,U,K,L,Math.PI/2*G),W=o(t,h,i(t,h,R=V[0],U=V[1]),b),X=W[0],Y=W[1],Z=o(f,v,i(f,v,R,U),E),$=Z[0],tt=Z[1],rt=i(R,U,t,h),nt=i(R,U,f,v),at=u(X,Y,$,tt,.5),it=at[0],ot=at[1],ut=u(X,Y,$,tt,.5-H),et=ut[0],ht=ut[1],ft=n(et,ht,it,ot,Math.PI/2*G),vt=u(R,U,et=ft[0],ht=ft[1],.5);return[X,Y,vt[0],vt[1],$,tt,nt,rt,N]},exports.getBoxToBoxArrow=function(o,f,m,p,I,P,l,b,w){var E,g,y,A;void 0===w&&(w={});var B=w.bow,N=void 0===B?0:B,S=w.stretch,_=void 0===S?.25:S,j=w.stretchMin,q=void 0===j?50:j,O=w.stretchMax,T=void 0===O?420:O,k=w.padStart,z=void 0===k?0:k,C=w.padEnd,D=void 0===C?20:C,F=w.flip,G=void 0!==F&&F,H=w.straights,J=void 0===H||H,K=o-z,L=f-z,Q=m+2*z,R=p+2*z,U=I-D,V=P-D,W=l+2*D,X=b+2*D,Y=o+m/2,Z=f+p/2,$=I+l/2,tt=P+b/2,rt=h(i(Y,Z,$,tt)),nt=a(Y,Z,$,tt);if(0===nt){var at=Y,it=L,ot=$,ut=V,et=u(at,it,ot,ut,.5),ht=et[0],ft=et[1],vt=i(at,it,ot,ut);return[at,it,ht,ft,ot,ut,vt,vt,vt]}var Mt=(e(rt)%2==0?-1:1)*(G?-1:1),ct=function(r){return Math.abs(Math.abs(r%(t/2))-t/4)/(t/4)}(rt);ct<1&&ct>.85&&(ct=.99);var st=function(t,r,n,a,i,o,u,e){return!(t>=i+u||i>=t+n||r>=o+e||o>=r+a)}(K,L,Q,R,U,V,W,X),dt=function(t,r,n,a,i,o,u,e,h,f){var v=t+n/2,c=r+a/2,s=o+e/2,d=u+h/2,x=(M(v,c,s-v,d-c,t,r,n,a,i)||[[v,c]])[0],m=x[0],p=x[1],I=(M(s,d,v-s,c-d,o,u,e,h,f)||[[s,d]])[0];return[m,p,I[0],I[1]]}(K,L,Q,R,z,U,V,W,X,D),xt=dt[0],mt=dt[1],pt=dt[2],It=dt[3],Pt=a(xt,mt,pt,It);if(!st&&J&&ct%.5==0){var lt=u(xt,mt,pt,It,.5);return[xt,mt,lt[0],lt[1],pt,It,rt,rt-s,rt]}var bt=st?r(Pt,[0,nt],[0,1],!0):0,wt=1-Pt/nt,Et=N+r(Pt,[q,T],[1,0],!0)*_,gt=r(ct*ct,[0,1],[.125*s,0],!0),yt=st?.5*s*ct:r(wt,[.75,1],[0,.5*s],!0)*ct,At=v(bt>=.5?(d+(rt+s*Mt))%d:(d+(rt+Math.max(x,yt+gt*(st?1-bt:1))*Mt))%d),Bt=At[0],Nt=At[1],St=M(Y,Z,Bt,Nt,K,L,Q,R,z)[0],_t=St[0],jt=St[1],qt=c(K,L,Q,R,Y,Z,Bt,Nt);if(!qt)throw Error;var Ot=u(qt[0],qt[1],qt[2],qt[3],.5),Tt=Ot[0],kt=Ot[1],zt=u(_t,jt,Tt,kt,st?Math.max(bt,.15):.15);if(E=zt[0],g=zt[1],Et*=1+(Math.max(-2,Math.min(wt,2))*ct-bt)/2,st&&(Et=Et<0?Math.min(Et,-.5):Math.max(Et,.5)),bt>=.5){var Ct=v(i(Y,Z,Tt,kt)),Dt=M($,tt,Ct[0],Ct[1],U,V,W,X,D)[0];y=Dt[0],A=Dt[1]}else{var Ft=r(wt,[.75,1],[0,1],!0),Gt=st?r(bt,[0,1],[0,s/8],!0):0,Ht=r(ct*Ft,[0,1],[0,s/16],!0),Jt=v(bt>=.5?(d+(rt+s*Mt))%d:(d+(rt+Math.max(x,wt*(s/12)+(Ht+Gt)+(yt+gt)/2)*Mt))%d),Kt=Jt[0],Lt=Jt[1],Qt=M($,tt,Kt,Lt,U,V,W,X,D)[0],Rt=Qt[0],Ut=Qt[1],Vt=c(U,V,W,X,$,tt,Kt,Lt);if(!Vt)throw Error;var Wt=u(Vt[0],Vt[1],Vt[2],Vt[3],.5),Xt=u(Rt,Ut,Wt[0],Wt[1],.25+.25*bt);y=Xt[0],A=Xt[1]}var Yt=u(E,g,y,A,.5),Zt=Yt[0],$t=Yt[1],tr=u(E,g,y,A,Math.max(-1,Math.min(1,.5+Et))),rr=tr[0],nr=tr[1],ar=n(rr,nr,Zt,$t,s/2*Mt),ir=ar[0],or=ar[1],ur=n(rr,nr,Zt,$t,s/2*-Mt),er=ur[0],hr=ur[1],fr=st&&a(ir,or,$,tt)<a(er,hr,$,tt)?[er,hr]:[ir,or],vr=fr[0],Mr=fr[1],cr=i(vr,Mr,E,g);return[E,g,vr,Mr,y,A,i(vr,Mr,y,A),cr,i(E,g,y,A)]}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=Math.PI;function r(t,r,n,a){void 0===a&&(a=!1);var i=r[0],o=n[0],u=n[1],e=o+(t-i)/(r[1]-i)*(u-o);if(!0===a)if(o<u){if(e<o)return o;if(e>u)return u}else{if(e>o)return o;if(e<u)return u}return e}function n(t,r,n,a,i){var o=Math.sin(i),u=Math.cos(i),e=t-n,h=r-a;return[e*u-h*o+n,e*o+h*u+a]}function a(t,r,n,a){return Math.hypot(a-r,n-t)}function i(t,r,n,a){return Math.atan2(a-r,n-t)}function o(t,r,n,a){return[Math.cos(n)*a+t,Math.sin(n)*a+r]}function u(t,r,n,a,i){return void 0===i&&(i=.5),[t+(n-t)*i,r+(a-r)*i]}function e(r,n){return void 0===n&&(n=8),Math.floor(n*(.5+r/(2*t)%n))}function h(r){return r-2*t*Math.floor(r/(2*t))}function f(t,r,n,a,i,o,u,e){var h,f,v;if(a*(u-i)!=n*(e-o)&&0!=(v=n*(e-o)-a*(u-i))&&(f=((r-o)*n-(t-i)*a)/v,(h=((r-o)*(u-i)-(t-i)*(e-o))/v)>=0&&f>=0&&f<=1))return[t+h*n,r+h*a]}function v(t){return[Math.cos(t),Math.sin(t)]}function M(t,r,n,a,o,u,e,v,M){var c=o+e,s=u+v,d=o+M-1,x=u+M-1,P=o+e-M+1,m=u+v-M+1,p=[[d,x,Math.PI,1.5*Math.PI],[P,x,1.5*Math.PI,2*Math.PI],[P,m,0,.5*Math.PI],[d,m,.5*Math.PI,Math.PI]],I=[];return[[o,m,o,x],[d,u,P,u],[c,x,c,m],[P,s,d,s]].forEach((function(o,u){var e=o[0],v=o[1],c=o[2],s=o[3],d=p[u],x=d[0],P=d[1],m=d[2],l=d[3],b=function(t,r,n,a,i,o,u){return function(t,r,n,a,i,o,u){var e,h,f,v,M,c,s,d,x=[o-a,u-i],P=[a-t,i-r];return e=x[0]*P[0]+x[1]*P[1],h=2*(x[0]*x[0]+x[1]*x[1]),e*=-2,f=Math.sqrt(e*e-2*h*(P[0]*P[0]+P[1]*P[1]-n*n)),isNaN(f)?[]:(M=(e+f)/h,s=[],d=[],c=[],(v=(e-f)/h)<=1&&v>=0&&(s[0]=a+x[0]*v,s[1]=i+x[1]*v,c[0]=s),M<=1&&M>=0&&(d[0]=a+x[0]*M,d[1]=i+x[1]*M,c[c.length]=d),c)}(t,r,n,a,i,999999*o,999999*u)}(x,P,M,t,r,n,a);b&&b.filter((function(t){var r=h(i(x,P,t[0],t[1]));return r>m&&r<l})).forEach((function(t){return I.push(t)}));var w=f(t,r,n,a,e,v,c,s);w&&I.push(w)})),I}function c(t,r,n,a,i,o,u,e){return function(t,r,n,a){return[[t,r,t+n,r],[t+n,r,t+n,r+a],[t+n,r+a,t,r+a],[t,r+a,t,r]]}(t,r,n,a).find((function(t){return f(i,o,u,e,t[0],t[1],t[2],t[3])}))}var s=Math.PI,d=2*s,x=s/24;exports.getArrow=function(t,h,f,v,M){void 0===M&&(M={});var c=M.bow,s=void 0===c?0:c,d=M.stretch,x=void 0===d?.5:d,P=M.stretchMin,m=void 0===P?0:P,p=M.stretchMax,I=void 0===p?420:p,l=M.padStart,b=void 0===l?0:l,w=M.padEnd,E=void 0===w?0:w,g=M.flip,y=void 0!==g&&g,A=M.straights,B=void 0===A||A,N=i(t,h,f,v),S=a(t,h,f,v),_=function(t,r,n,a){return Math.abs((n-t)/2/((a-r)/2))}(t,h,f,v);if(S<2*(b+E)||0===s&&0===x||B&&[0,1,Infinity].includes(_)){var j=Math.max(0,Math.min(S-b,b)),q=Math.max(0,Math.min(S-j,E)),O=o(t,h,N,j),T=O[0],k=O[1],z=o(f,v,N+Math.PI,q),C=z[0],D=z[1],F=u(T,k,C,D,.5);return[T,k,F[0],F[1],C,D,N,N,N]}var G=(e(N)%2==0?1:-1)*(y?-1:1),H=s+r(S,[m,I],[1,0],!0)*x,J=u(t,h,f,v,.5),K=J[0],L=J[1],Q=u(t,h,f,v,.5-H),R=Q[0],U=Q[1],V=n(R,U,K,L,Math.PI/2*G),W=o(t,h,i(t,h,R=V[0],U=V[1]),b),X=W[0],Y=W[1],Z=o(f,v,i(f,v,R,U),E),$=Z[0],tt=Z[1],rt=i(R,U,t,h),nt=i(R,U,f,v),at=u(X,Y,$,tt,.5),it=at[0],ot=at[1],ut=u(X,Y,$,tt,.5-H),et=ut[0],ht=ut[1],ft=n(et,ht,it,ot,Math.PI/2*G),vt=u(R,U,et=ft[0],ht=ft[1],.5);return[X,Y,vt[0],vt[1],$,tt,nt,rt,N]},exports.getBoxToBoxArrow=function(o,f,P,m,p,I,l,b,w){var E,g,y,A;void 0===w&&(w={});var B=w.bow,N=void 0===B?0:B,S=w.stretch,_=void 0===S?.25:S,j=w.stretchMin,q=void 0===j?50:j,O=w.stretchMax,T=void 0===O?420:O,k=w.padStart,z=void 0===k?0:k,C=w.padEnd,D=void 0===C?20:C,F=w.flip,G=void 0!==F&&F,H=w.straights,J=void 0===H||H,K=o-z,L=f-z,Q=P+2*z,R=m+2*z,U=p-D,V=I-D,W=l+2*D,X=b+2*D,Y=o+P/2,Z=f+m/2,$=p+l/2,tt=I+b/2,rt=h(i(Y,Z,$,tt)),nt=a(Y,Z,$,tt);if(0===nt){var at=Y,it=L,ot=$,ut=V,et=u(at,it,ot,ut,.5),ht=et[0],ft=et[1],vt=i(at,it,ot,ut);return[at,it,ht,ft,ot,ut,vt,vt,vt]}var Mt=(e(rt)%2==0?-1:1)*(G?-1:1),ct=function(r){return Math.abs(Math.abs(r%(t/2))-t/4)/(t/4)}(rt);ct<1&&ct>.85&&(ct=.99);var st=function(t,r,n,a,i,o,u,e){return!(t>=i+u||i>=t+n||r>=o+e||o>=r+a)}(K,L,Q,R,U,V,W,X),dt=function(t,r,n,a,i,o,u,e,h,f){var v=t+n/2,c=r+a/2,s=o+e/2,d=u+h/2,x=(M(v,c,s-v,d-c,t,r,n,a,i)||[[v,c]])[0],P=x[0],m=x[1],p=(M(s,d,v-s,c-d,o,u,e,h,f)||[[s,d]])[0];return[P,m,p[0],p[1]]}(K,L,Q,R,z,U,V,W,X,D),xt=dt[0],Pt=dt[1],mt=dt[2],pt=dt[3],It=a(xt,Pt,mt,pt);if(!st&&J&&ct%.5==0){var lt=u(xt,Pt,mt,pt,.5);return[xt,Pt,lt[0],lt[1],mt,pt,rt,rt-s,rt]}var bt=st?r(It,[0,nt],[0,1],!0):0,wt=1-It/nt,Et=N+r(It,[q,T],[1,0],!0)*_,gt=r(ct*ct,[0,1],[.125*s,0],!0),yt=st?.5*s*ct:r(wt,[.75,1],[0,.5*s],!0)*ct,At=v(+((bt>=.5?rt+s*Mt:rt+Math.max(x,yt+gt*(st?1-bt:1))*Mt)%d).toPrecision(3)),Bt=At[0],Nt=At[1],St=M(Y,Z,Bt,Nt,K,L,Q,R,z)[0],_t=St[0],jt=St[1],qt=c(K,L,Q,R,Y,Z,Bt,Nt);if(!qt)throw Error;var Ot=u(qt[0],qt[1],qt[2],qt[3],.5),Tt=Ot[0],kt=Ot[1],zt=u(_t,jt,Tt,kt,st?Math.max(bt,.15):.15);if(E=zt[0],g=zt[1],Et*=1+(Math.max(-2,Math.min(wt,2))*ct-bt)/2,st&&(Et=Et<0?Math.min(Et,-.5):Math.max(Et,.5)),bt>=.5){var Ct=v(i(Y,Z,Tt,kt)),Dt=M($,tt,Ct[0],Ct[1],U,V,W,X,D)[0];y=Dt[0],A=Dt[1]}else{var Ft=r(wt,[.75,1],[0,1],!0),Gt=st?r(bt,[0,1],[0,s/8],!0):0,Ht=r(ct*Ft,[0,1],[0,s/16],!0),Jt=v(+((bt>=.5?rt+s*Mt:rt+s-Math.max(wt*(s/12)+(Ht+Gt)+(yt+gt)/2,x)*Mt)%d).toPrecision(3)),Kt=Jt[0],Lt=Jt[1],Qt=M($,tt,Kt,Lt,U,V,W,X,D)[0],Rt=Qt[0],Ut=Qt[1],Vt=c(U,V,W,X,$,tt,Kt,Lt);if(!Vt)throw Error;var Wt=u(Vt[0],Vt[1],Vt[2],Vt[3],.5),Xt=u(Rt,Ut,Wt[0],Wt[1],.25+.25*bt);y=Xt[0],A=Xt[1]}var Yt=u(E,g,y,A,.5),Zt=Yt[0],$t=Yt[1],tr=u(E,g,y,A,Math.max(-1,Math.min(1,.5+Et))),rr=tr[0],nr=tr[1],ar=n(rr,nr,Zt,$t,s/2*Mt),ir=ar[0],or=ar[1],ur=n(rr,nr,Zt,$t,s/2*-Mt),er=ur[0],hr=ur[1],fr=st&&a(ir,or,$,tt)<a(er,hr,$,tt)?[er,hr]:[ir,or],vr=fr[0],Mr=fr[1],cr=i(vr,Mr,E,g);return[E,g,vr,Mr,y,A,i(vr,Mr,y,A),cr,i(E,g,y,A)]}; | ||
//# sourceMappingURL=perfect-arrows.cjs.production.min.js.map |
@@ -613,14 +613,15 @@ var PI = Math.PI; | ||
var finalAngle0 = overlapEffect >= 0.5 ? (PI2 + (angle + PI$1 * rot)) % PI2 : (PI2 + (angle + Math.max(MIN_ANGLE, combinedOffset) * rot)) % PI2; // Deltas of starting angle | ||
var finalAngle0 = overlapEffect >= 0.5 ? angle + PI$1 * rot : angle + Math.max(MIN_ANGLE, combinedOffset) * rot; // Deltas of starting angle | ||
var _getDelta = getDelta(finalAngle0), | ||
var _getDelta = getDelta(+(finalAngle0 % PI2).toPrecision(3)), | ||
dx0 = _getDelta[0], | ||
dy0 = _getDelta[1]; | ||
dy0 = _getDelta[1]; // Get ray intersection with rounded rectangle | ||
var intersectionsA = getRayRoundedRectangleIntersection(cx0, cy0, dx0, dy0, px0, py0, pw0, ph0, padStart); // Get ray intersection with rounded rectangle | ||
var _intersectionsA$ = intersectionsA[0], | ||
tsx = _intersectionsA$[0], | ||
tsy = _intersectionsA$[1]; // Get midpoint of startingintersected segment | ||
var _getRayRoundedRectang = getRayRoundedRectangleIntersection(cx0, cy0, dx0, dy0, px0, py0, pw0, ph0, padStart), | ||
_getRayRoundedRectang2 = _getRayRoundedRectang[0], | ||
tsx = _getRayRoundedRectang2[0], | ||
tsy = _getRayRoundedRectang2[1]; // Get midpoint of startingintersected segment | ||
var startSeg = getRectangleSegmentIntersectedByRay(px0, py0, pw0, ph0, cx0, cy0, dx0, dy0); | ||
@@ -658,7 +659,7 @@ if (!startSeg) throw Error; // Find start point (quarter way between segment midpoint and ray intersection) | ||
var _getRayRoundedRectang = getRayRoundedRectangleIntersection(cx1, cy1, dx1, dy1, px1, py1, pw1, ph1, padEnd); | ||
var _getRayRoundedRectang3 = getRayRoundedRectangleIntersection(cx1, cy1, dx1, dy1, px1, py1, pw1, ph1, padEnd); | ||
var _getRayRoundedRectang2 = _getRayRoundedRectang[0]; | ||
ex = _getRayRoundedRectang2[0]; | ||
ey = _getRayRoundedRectang2[1]; | ||
var _getRayRoundedRectang4 = _getRayRoundedRectang3[0]; | ||
ex = _getRayRoundedRectang4[0]; | ||
ey = _getRayRoundedRectang4[1]; | ||
} else { | ||
@@ -672,5 +673,5 @@ // Calculate an angle based on distance, overlap and intermediacy | ||
var finalAngle1 = overlapEffect >= 0.5 ? (PI2 + (angle + PI$1 * rot)) % PI2 : (PI2 + (angle + Math.max(MIN_ANGLE, _combinedOffset) * rot)) % PI2; // Deltas of ending angle | ||
var finalAngle1 = overlapEffect >= 0.5 ? angle + PI$1 * rot : angle + PI$1 - Math.max(_combinedOffset, MIN_ANGLE) * rot; // Deltas of ending angle | ||
var _getDelta3 = getDelta(finalAngle1), | ||
var _getDelta3 = getDelta(+(finalAngle1 % PI2).toPrecision(3)), | ||
_dx = _getDelta3[0], | ||
@@ -680,6 +681,6 @@ _dy = _getDelta3[1]; // Get ray intersection with ending rounded rectangle | ||
var _getRayRoundedRectang3 = getRayRoundedRectangleIntersection(cx1, cy1, _dx, _dy, px1, py1, pw1, ph1, padEnd), | ||
_getRayRoundedRectang4 = _getRayRoundedRectang3[0], | ||
tex = _getRayRoundedRectang4[0], | ||
tey = _getRayRoundedRectang4[1]; // Get midpoint of ending intersected segment | ||
var _getRayRoundedRectang5 = getRayRoundedRectangleIntersection(cx1, cy1, _dx, _dy, px1, py1, pw1, ph1, padEnd), | ||
_getRayRoundedRectang6 = _getRayRoundedRectang5[0], | ||
tex = _getRayRoundedRectang6[0], | ||
tey = _getRayRoundedRectang6[1]; // Get midpoint of ending intersected segment | ||
@@ -686,0 +687,0 @@ |
{ | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -186,11 +186,12 @@ import { | ||
// Angle of the first box | ||
const finalAngle0 = | ||
let finalAngle0 = | ||
overlapEffect >= 0.5 | ||
? (PI2 + (angle + PI * rot)) % PI2 | ||
: (PI2 + (angle + Math.max(MIN_ANGLE, combinedOffset) * rot)) % PI2 | ||
? angle + PI * rot | ||
: angle + Math.max(MIN_ANGLE, combinedOffset) * rot | ||
// Deltas of starting angle | ||
const [dx0, dy0] = getDelta(finalAngle0) | ||
const [dx0, dy0] = getDelta(+(finalAngle0 % PI2).toPrecision(3)) | ||
const intersectionsA = getRayRoundedRectangleIntersection( | ||
// Get ray intersection with rounded rectangle | ||
const [[tsx, tsy]] = getRayRoundedRectangleIntersection( | ||
cx0, | ||
@@ -207,5 +208,2 @@ cy0, | ||
// Get ray intersection with rounded rectangle | ||
const [[tsx, tsy]] = intersectionsA | ||
// Get midpoint of startingintersected segment | ||
@@ -274,9 +272,9 @@ const startSeg = getRectangleSegmentIntersectedByRay( | ||
const finalAngle1 = | ||
let finalAngle1 = | ||
overlapEffect >= 0.5 | ||
? (PI2 + (angle + PI * rot)) % PI2 | ||
: (PI2 + (angle + Math.max(MIN_ANGLE, combinedOffset) * rot)) % PI2 | ||
? angle + PI * rot | ||
: angle + PI - Math.max(combinedOffset, MIN_ANGLE) * rot | ||
// Deltas of ending angle | ||
const [dx1, dy1] = getDelta(finalAngle1) | ||
const [dx1, dy1] = getDelta(+(finalAngle1 % PI2).toPrecision(3)) | ||
@@ -283,0 +281,0 @@ // Get ray intersection with ending rounded rectangle |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
269217
2707