0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00

added missing polyfill warning to Svg.pathToVertices

This commit is contained in:
liabru 2018-06-11 18:55:27 +01:00
parent 1e5758fa6e
commit 511de5b494

View file

@ -13,6 +13,7 @@ var Svg = {};
module.exports = Svg;
var Bounds = require('../geometry/Bounds');
var Common = require('../core/Common');
(function() {
@ -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,