mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
parent
7dd3bfa2ec
commit
ac2161c6d9
1 changed files with 8 additions and 5 deletions
|
@ -116,11 +116,14 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function importPoly(node, type) {
|
function importPoly(node, type) {
|
||||||
var path = new Path(),
|
var coords = node.getAttribute('points').match(
|
||||||
points = node.points;
|
/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g),
|
||||||
path.moveTo(points.getItem(0));
|
points = [];
|
||||||
for (var i = 1, l = points.numberOfItems; i < l; i++)
|
for (var i = 0, l = coords.length; i < l; i += 2)
|
||||||
path.lineTo(points.getItem(i));
|
points.push(new Point(
|
||||||
|
parseFloat(coords[i]),
|
||||||
|
parseFloat(coords[i + 1])));
|
||||||
|
var path = new Path(points);
|
||||||
if (type === 'polygon')
|
if (type === 'polygon')
|
||||||
path.closePath();
|
path.closePath();
|
||||||
return path;
|
return path;
|
||||||
|
|
Loading…
Reference in a new issue