2.1.2 • Published 5 years ago

skia-point-in-svg-path v2.1.2

Weekly downloads
5
License
ISC
Repository
github
Last release
5 years ago

skia-point-in-svg-path

Uses the SKIA C 2-d graphics library to determine if a given point is within a closed SVG path.

travis

Install

npm i skia-point-in-svg-path

Example

const getPointsAndIntersectingPaths = require('skia-point-in-svg-path')
  
const results = getPointsAndIntersectingPaths(
  [{ id: 'test-path', data: 'M80 80A 45 45, 0, 0, 0, 125 125L 125 80 Z' }], 
  [{ id: 'test-point', x: 100, y: 100 }, { id: 'test-point', x:750, y: 500 }]
);

console.log(results);
/*
[ { pointId: 'test-point',
    x: 100,
    y: 100,
    intersectingPathIds: [ 'test-path' ] },
  { pointId: 'test-point', x: 750, y: 500, intersectingPathIds: [] } ]
*/

Why?

Determining if a point falls withing an arbitrary, closed, SVG path is difficult and I'd rather use a well-tested graphics library to determine that :)

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago