mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
added missing polyfill warning to Svg.pathToVertices
This commit is contained in:
parent
1e5758fa6e
commit
511de5b494
1 changed files with 6 additions and 0 deletions
|
@ -13,6 +13,7 @@ var Svg = {};
|
||||||
module.exports = Svg;
|
module.exports = Svg;
|
||||||
|
|
||||||
var Bounds = require('../geometry/Bounds');
|
var Bounds = require('../geometry/Bounds');
|
||||||
|
var Common = require('../core/Common');
|
||||||
|
|
||||||
(function() {
|
(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.
|
* 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.
|
* See `Bodies.fromVertices` which provides support for this.
|
||||||
* Note that this function is not guaranteed to support complex paths (such as those with holes).
|
* 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
|
* @method pathToVertices
|
||||||
* @param {SVGPathElement} path
|
* @param {SVGPathElement} path
|
||||||
* @param {Number} [sampleLength=15]
|
* @param {Number} [sampleLength=15]
|
||||||
* @return {Vector[]} points
|
* @return {Vector[]} points
|
||||||
*/
|
*/
|
||||||
Svg.pathToVertices = function(path, sampleLength) {
|
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
|
// https://github.com/wout/svg.topoly.js/blob/master/svg.topoly.js
|
||||||
var i, il, total, point, segment, segments,
|
var i, il, total, point, segment, segments,
|
||||||
segmentsQueue, lastSegment,
|
segmentsQueue, lastSegment,
|
||||||
|
|
Loading…
Reference in a new issue