skia-point-in-svg-path

2.1.2 • Public • Published

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 :)

Readme

Keywords

none

Package Sidebar

Install

npm i skia-point-in-svg-path

Weekly Downloads

0

Version

2.1.2

License

ISC

Unpacked Size

25.5 MB

Total Files

11

Last publish

Collaborators

  • max.nachlinger