Skip to content

Commit

Permalink
added missing polyfill warning to Svg.pathToVertices
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Jun 11, 2018
1 parent 1e5758f commit 511de5b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/geometry/Svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var Svg = {};
module.exports = Svg;

var Bounds = require('../geometry/Bounds');
var Common = require('../core/Common');

(function() {

Expand All @@ -21,12 +22,17 @@ var Bounds = require('../geometry/Bounds');
* If the input path forms a concave shape, you must decompose the result into convex parts before use.
* See `Bodies.fromVertices` which provides support for this.
* Note that this function is not guaranteed to support complex paths (such as those with holes).
* You must load the `pathseg.js` polyfill on newer browsers.
* @method pathToVertices
* @param {SVGPathElement} path
* @param {Number} [sampleLength=15]
* @return {Vector[]} points
*/
Svg.pathToVertices = function(path, sampleLength) {
if (typeof window !== 'undefined' && !('SVGPathSeg' in window)) {
Common.warn('Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.');
}

// https://github.com/wout/svg.topoly.js/blob/master/svg.topoly.js
var i, il, total, point, segment, segments,
segmentsQueue, lastSegment,
Expand Down

0 comments on commit 511de5b

Please sign in to comment.