Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.1.0 to 0.1.1

4

dist/perfect-freehand.cjs.development.js

@@ -137,2 +137,6 @@ 'use strict';

if (len === 0) {
return '';
}
if (len < 4) {

@@ -139,0 +143,0 @@ // Just draw a dot on very short marks

2

dist/perfect-freehand.cjs.production.min.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=(e=require("polygon-clipping"))&&"object"==typeof e&&"default"in e?e.default:e;function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function n(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,void 0):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var o=Math.hypot,a=Math.cos,i=Math.max,u=Math.min,s=Math.sin,v=Math.atan2,l=Math.PI/2;function f(e,r,t,n){return[a(t)*n+e,s(t)*n+r]}function d(e,r,t,n){return[e+(t-e)/2,r+(n-r)/2]}exports.default=function(e,t){void 0===t&&(t={});var a,s,p,h,c=t.type,y=void 0===c?"mouse":c,m=t.simulatePressure,M=void 0===m||m,b=t.streamline,g=void 0===b?.5:b,A=t.minSize,S=void 0===A?2.5:A,x=t.maxSize,j=void 0===x?8:x,I=t.smooth,w=void 0===I?8:I,O=t.pressureChangeRate,P=void 0===O?.5:O,z=t.pressureMaxVelocity,C=void 0===z?8:z,E=t.pressureVelocityEffect,V=void 0===E?8:E,_=function(e){return Array.isArray(e[0])?e.map((function(e){var r=e[2];return[e[0],e[1],void 0===r?.5:r]})):e.map((function(e){var r=e.pressure;return[e.x,e.y,void 0===r?.5:r]}))}(e),q=[],Q=_.length,R=0,T=_[0],U=_[Q-1],$=T,k=T,B=U,D=T,F=T,G=0,H="";if(Q<4){var J=(S+(j-S))*("pen"===y?U[2]:.44);H="\n M "+(U[0]-J)+","+U[1]+"\n a "+J+","+J+" 0 1,0 "+2*J+",0\n a "+J+","+J+" 0 1,0 -"+2*J+",0\n "}else{for(var K=0;K<_.length;K++){var L=_[K],N=L[2],W=$[0],X=$[1],Y=$[2];if(p=v((s=X+(L[1]-X)*(1-g))-X,(a=W+(L[0]-W)*(1-g))-W),G+=R=o(s-X,a-W),"pen"===y)N=Y+(N-Y)*P;else if(M){var Z=1-R/C,ee=Math.min(R/V,1);N=i(0,u(1,Y+P*ee*(Z-Y)))}else N=1;if(h=S+N*(j-S),G<16){var re=G/16;h*=re*re*re}T=f(a,s,p-l,h),U=f(a,s,p+l,h),0===K?(k=T,B=U):(Math.hypot(T[0]-k[0],T[1]-k[1])>w&&(q.push(D),D=d(k[0],k[1],T[0],T[1]),k=T),Math.hypot(U[0]-B[0],U[1]-B[1])>w&&(q.unshift(F),F=d(B[0],B[1],U[0],U[1]),B=U)),$=[a,s,p,R,h]}q.push($),q.unshift($);for(var te,ne=n(r.union([q]));!(te=ne()).done;)for(var oe,ae=n(te.value);!(oe=ae()).done;){var ie=oe.value,ue=ie[0],se=ie[1];ie.push(ue),H+=" M "+ue[0]+" "+ue[1];for(var ve=1;ve<ie.length;ve++){var le=d(ue[0],ue[1],se[0],se[1]);H+=" Q "+ue[0]+","+ue[1]+" "+le[0]+","+le[1],ue=se,se=ie[ve+1]}}}return H};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=(e=require("polygon-clipping"))&&"object"==typeof e&&"default"in e?e.default:e;function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function n(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,void 0):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var o=Math.hypot,a=Math.cos,i=Math.max,u=Math.min,s=Math.sin,v=Math.atan2,l=Math.PI/2;function f(e,r,t,n){return[a(t)*n+e,s(t)*n+r]}function d(e,r,t,n){return[e+(t-e)/2,r+(n-r)/2]}exports.default=function(e,t){void 0===t&&(t={});var a,s,p,h,c=t.type,y=void 0===c?"mouse":c,m=t.simulatePressure,M=void 0===m||m,b=t.streamline,g=void 0===b?.5:b,A=t.minSize,S=void 0===A?2.5:A,x=t.maxSize,j=void 0===x?8:x,I=t.smooth,w=void 0===I?8:I,O=t.pressureChangeRate,P=void 0===O?.5:O,z=t.pressureMaxVelocity,C=void 0===z?8:z,E=t.pressureVelocityEffect,V=void 0===E?8:E,_=function(e){return Array.isArray(e[0])?e.map((function(e){var r=e[2];return[e[0],e[1],void 0===r?.5:r]})):e.map((function(e){var r=e.pressure;return[e.x,e.y,void 0===r?.5:r]}))}(e),q=[],Q=_.length,R=0,T=_[0],U=_[Q-1],$=T,k=T,B=U,D=T,F=T,G=0,H="";if(0===Q)return"";if(Q<4){var J=(S+(j-S))*("pen"===y?U[2]:.44);H="\n M "+(U[0]-J)+","+U[1]+"\n a "+J+","+J+" 0 1,0 "+2*J+",0\n a "+J+","+J+" 0 1,0 -"+2*J+",0\n "}else{for(var K=0;K<_.length;K++){var L=_[K],N=L[2],W=$[0],X=$[1],Y=$[2];if(p=v((s=X+(L[1]-X)*(1-g))-X,(a=W+(L[0]-W)*(1-g))-W),G+=R=o(s-X,a-W),"pen"===y)N=Y+(N-Y)*P;else if(M){var Z=1-R/C,ee=Math.min(R/V,1);N=i(0,u(1,Y+P*ee*(Z-Y)))}else N=1;if(h=S+N*(j-S),G<16){var re=G/16;h*=re*re*re}T=f(a,s,p-l,h),U=f(a,s,p+l,h),0===K?(k=T,B=U):(Math.hypot(T[0]-k[0],T[1]-k[1])>w&&(q.push(D),D=d(k[0],k[1],T[0],T[1]),k=T),Math.hypot(U[0]-B[0],U[1]-B[1])>w&&(q.unshift(F),F=d(B[0],B[1],U[0],U[1]),B=U)),$=[a,s,p,R,h]}q.push($),q.unshift($);for(var te,ne=n(r.union([q]));!(te=ne()).done;)for(var oe,ae=n(te.value);!(oe=ae()).done;){var ie=oe.value,ue=ie[0],se=ie[1];ie.push(ue),H+=" M "+ue[0]+" "+ue[1];for(var ve=1;ve<ie.length;ve++){var le=d(ue[0],ue[1],se[0],se[1]);H+=" Q "+ue[0]+","+ue[1]+" "+le[0]+","+le[1],ue=se,se=ie[ve+1]}}}return H};
//# sourceMappingURL=perfect-freehand.cjs.production.min.js.map

@@ -131,2 +131,6 @@ import polygonClipping from 'polygon-clipping';

if (len === 0) {
return '';
}
if (len < 4) {

@@ -133,0 +137,0 @@ // Just draw a dot on very short marks

{
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -85,2 +85,6 @@ import polygonClipping from 'polygon-clipping'

if (len === 0) {
return ''
}
if (len < 4) {

@@ -87,0 +91,0 @@ // Just draw a dot on very short marks

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

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