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.2.1 to 0.2.2

2

dist/perfect-freehand.cjs.development.js

@@ -238,3 +238,3 @@ 'use strict';

if (pressure) {
if (ip === points[i - 1][2]) {
if (i > 1 && ip === points[i - 1][2]) {
// Accellerate the reported pressure.

@@ -241,0 +241,0 @@ var rp = min(1 - distance / maxSize, 1);

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r,t=(r=require("polygon-clipping"))&&"object"==typeof r&&"default"in r?r.default:r;function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function n(r,t){var n;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r)return e(r,void 0);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,void 0):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[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=r[Symbol.iterator]()).next.bind(n)}var o=Math.hypot,i=Math.cos,a=Math.max,u=Math.min,v=Math.sin,f=Math.atan2,l=Math.PI,s=l/2;function h(r,t,e,n){return[i(e)*n+r,v(e)*n+t]}function p(r,t,e,n,o){return void 0===o&&(o=.5),[r+(e-r)*o,t+(n-t)*o]}function d(r,t){void 0===t&&(t={});var e,n,i,a=t.streamline,u=void 0===a?.5:a,v=function(r){return Array.isArray(r[0])?r.map((function(r){var t=r[2];return[r[0],r[1],void 0===t?.5:t]})):r.map((function(r){var t=r.pressure;return[r.x,r.y,void 0===t?.5:t]}))}(r),l=0,s=.01,h=v.length,p=[].concat(v[0],[0,0,0]),d=[p];if(0===h)return[];for(var c=1;c<h;c++){var m=v[c],y=m[2],g=p[0],S=p[1];i=f((n=S+(m[1]-S)*(1-u))-S,(e=g+(m[0]-g)*(1-u))-g),s=o(n-S,e-g),d.push(p=[e,n,y,i,s,l+=s])}return d.length>1&&(d[0][2]=d[1][2]),d}function c(r,t){void 0===t&&(t={});var e=t.minSize,n=void 0===e?2.5:e,o=t.maxSize,i=void 0===o?8:o,a=r.length;if(0===a)return[];var u=r[0],v=r[a-1],d=u[2]===v[2]?i:n+(i-n)*v[2],c=u===v?Math.random()*(2*l):f(v[1]-u[1],v[0]-u[0]),m=p(u[0],u[1],v[0],v[1],.5);return[h(m[0],m[1],c+s,d),h(u[0],u[1],c+l,d),h(m[0],m[1],c-s,d),h(v[0],v[1],c,d),h(m[0],m[1],c+s,d)]}function m(r,t){void 0===t&&(t={});var e=t.pressure,n=void 0===e||e,o=t.minSize,i=void 0===o?2.5:o,v=t.maxSize,f=void 0===v?8:v,l=t.smooth,d=void 0===l?8:l,c=r.length,m=r[0],y=r[0],g=m,S=y,b=m,M=m,x=0,A=.5,j=y,P=[];if(0===c)return[];for(var z=1;z<c;z++){var O=r[z],I=O[0],k=O[1],w=O[2],Q=O[3],_=O[4];if(n){if(w===r[z-1][2]){var q=u(1-_/f,1),C=u(_/f,1);w=u(1,A+C/2*(q-A))}x=a(i,u(f,i+w*(f-i)))}else x=f;m=h(I,k,Q-s,x),y=h(I,k,Q+s,x),0===z?(g=m,S=y):(Math.hypot(m[0]-g[0],m[1]-g[1])>d&&(P.push(b),b=p(g[0],g[1],m[0],m[1],.5),g=m),Math.hypot(y[0]-S[0],y[1]-S[1])>d&&(P.unshift(M),M=p(S[0],S[1],y[0],y[1],.5),S=y)),A=w,j=[I,k]}return P.push(j),P.unshift(j),P}function y(r){return t.union([r])}exports.clipPath=y,exports.default=function(r,t){if(void 0===t&&(t={}),0===r.length)return"";var e=t.clip,o=void 0===e||e,i=t.maxSize,a=void 0===i?8:i,u=d(r,t),v=u[u.length-1][5]<2*a?c(u,t):m(u,t),f=[];if(o)for(var l,s=n(y(v));!(l=s()).done;)for(var h,g=n(l.value);!(h=g()).done;){var S=h.value,b=S[0],M=S[1];S.push(b),f.push("M "+b[0]+" "+b[1]);for(var x=1;x<S.length;x++){var A=p(b[0],b[1],M[0],M[1],.5);f.push(" Q "+b[0]+","+b[1]+" "+A[0]+","+A[1]),b=M,M=S[x+1]}}else{var j=v[0],P=v[1];v.push(j),f.push("M "+j[0]+" "+j[1]);for(var z=1;z<v.length;z++){var O=p(j[0],j[1],P[0],P[1],.5);f.push("Q "+j[0]+","+j[1]+" "+O[0]+","+O[1]),j=P,P=v[z+1]}}return f.join(" ")},exports.getShortStrokeOutlinePoints=c,exports.getStrokeOutlinePoints=m,exports.getStrokePoints=d;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r,t=(r=require("polygon-clipping"))&&"object"==typeof r&&"default"in r?r.default:r;function e(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function n(r,t){var n;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r)return e(r,void 0);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,void 0):void 0}}(r))||t&&r&&"number"==typeof r.length){n&&(r=n);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[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=r[Symbol.iterator]()).next.bind(n)}var o=Math.hypot,i=Math.cos,a=Math.max,u=Math.min,v=Math.sin,f=Math.atan2,l=Math.PI,s=l/2;function h(r,t,e,n){return[i(e)*n+r,v(e)*n+t]}function p(r,t,e,n,o){return void 0===o&&(o=.5),[r+(e-r)*o,t+(n-t)*o]}function d(r,t){void 0===t&&(t={});var e,n,i,a=t.streamline,u=void 0===a?.5:a,v=function(r){return Array.isArray(r[0])?r.map((function(r){var t=r[2];return[r[0],r[1],void 0===t?.5:t]})):r.map((function(r){var t=r.pressure;return[r.x,r.y,void 0===t?.5:t]}))}(r),l=0,s=.01,h=v.length,p=[].concat(v[0],[0,0,0]),d=[p];if(0===h)return[];for(var c=1;c<h;c++){var m=v[c],y=m[2],g=p[0],S=p[1];i=f((n=S+(m[1]-S)*(1-u))-S,(e=g+(m[0]-g)*(1-u))-g),s=o(n-S,e-g),d.push(p=[e,n,y,i,s,l+=s])}return d.length>1&&(d[0][2]=d[1][2]),d}function c(r,t){void 0===t&&(t={});var e=t.minSize,n=void 0===e?2.5:e,o=t.maxSize,i=void 0===o?8:o,a=r.length;if(0===a)return[];var u=r[0],v=r[a-1],d=u[2]===v[2]?i:n+(i-n)*v[2],c=u===v?Math.random()*(2*l):f(v[1]-u[1],v[0]-u[0]),m=p(u[0],u[1],v[0],v[1],.5);return[h(m[0],m[1],c+s,d),h(u[0],u[1],c+l,d),h(m[0],m[1],c-s,d),h(v[0],v[1],c,d),h(m[0],m[1],c+s,d)]}function m(r,t){void 0===t&&(t={});var e=t.pressure,n=void 0===e||e,o=t.minSize,i=void 0===o?2.5:o,v=t.maxSize,f=void 0===v?8:v,l=t.smooth,d=void 0===l?8:l,c=r.length,m=r[0],y=r[0],g=m,S=y,b=m,M=m,x=0,A=.5,j=y,P=[];if(0===c)return[];for(var z=1;z<c;z++){var O=r[z],I=O[0],k=O[1],w=O[2],Q=O[3],_=O[4];if(n){if(z>1&&w===r[z-1][2]){var q=u(1-_/f,1),C=u(_/f,1);w=u(1,A+C/2*(q-A))}x=a(i,u(f,i+w*(f-i)))}else x=f;m=h(I,k,Q-s,x),y=h(I,k,Q+s,x),0===z?(g=m,S=y):(Math.hypot(m[0]-g[0],m[1]-g[1])>d&&(P.push(b),b=p(g[0],g[1],m[0],m[1],.5),g=m),Math.hypot(y[0]-S[0],y[1]-S[1])>d&&(P.unshift(M),M=p(S[0],S[1],y[0],y[1],.5),S=y)),A=w,j=[I,k]}return P.push(j),P.unshift(j),P}function y(r){return t.union([r])}exports.clipPath=y,exports.default=function(r,t){if(void 0===t&&(t={}),0===r.length)return"";var e=t.clip,o=void 0===e||e,i=t.maxSize,a=void 0===i?8:i,u=d(r,t),v=u[u.length-1][5]<2*a?c(u,t):m(u,t),f=[];if(o)for(var l,s=n(y(v));!(l=s()).done;)for(var h,g=n(l.value);!(h=g()).done;){var S=h.value,b=S[0],M=S[1];S.push(b),f.push("M "+b[0]+" "+b[1]);for(var x=1;x<S.length;x++){var A=p(b[0],b[1],M[0],M[1],.5);f.push(" Q "+b[0]+","+b[1]+" "+A[0]+","+A[1]),b=M,M=S[x+1]}}else{var j=v[0],P=v[1];v.push(j),f.push("M "+j[0]+" "+j[1]);for(var z=1;z<v.length;z++){var O=p(j[0],j[1],P[0],P[1],.5);f.push("Q "+j[0]+","+j[1]+" "+O[0]+","+O[1]),j=P,P=v[z+1]}}return f.join(" ")},exports.getShortStrokeOutlinePoints=c,exports.getStrokeOutlinePoints=m,exports.getStrokePoints=d;
//# sourceMappingURL=perfect-freehand.cjs.production.min.js.map

@@ -232,3 +232,3 @@ import polygonClipping from 'polygon-clipping';

if (pressure) {
if (ip === points[i - 1][2]) {
if (i > 1 && ip === points[i - 1][2]) {
// Accellerate the reported pressure.

@@ -235,0 +235,0 @@ var rp = min(1 - distance / maxSize, 1);

{
"version": "0.2.1",
"version": "0.2.2",
"license": "MIT",

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

@@ -196,3 +196,3 @@ import polygonClipping from 'polygon-clipping'

if (pressure) {
if (ip === points[i - 1][2]) {
if (i > 1 && ip === points[i - 1][2]) {
// Accellerate the reported pressure.

@@ -199,0 +199,0 @@ let rp = min(1 - distance / maxSize, 1)

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