fabric
Version:
Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.
2 lines • 843 B
JavaScript
import{Point as e}from"../../../Point.min.mjs";import{findIndexRight as t}from"../../internals/findRight.min.mjs";import{StrokeLineJoinProjections as n}from"./StrokeLineJoinProjections.min.mjs";import{StrokeLineCapProjections as r}from"./StrokeLineCapProjections.min.mjs";const i=(i,a,o=!1)=>{let s=[];if(i.length===0)return s;let c=i.reduce((t,n)=>(t[t.length-1].eq(n)||t.push(new e(n)),t),[new e(i[0])]);if(c.length===1)o=!0;else if(!o){let e=c[0],n=t(c,t=>!t.eq(e));c.splice(n+1)}return c.forEach((e,t,i)=>{let c,l;t===0?(l=i[1],c=o?e:i[i.length-1]):t===i.length-1?(c=i[t-1],l=o?e:i[0]):(c=i[t-1],l=i[t+1]),o&&i.length===1?s.push(...new r(e,e,a).project()):!o||t!==0&&t!==i.length-1?s.push(...new n(e,c,l,a).project()):s.push(...new r(e,t===0?l:c,a).project())}),s};export{i as projectStrokeOnPoints};
//# sourceMappingURL=index.min.mjs.map