mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Fix SVGImporter tests for all polygon related code.
#length was used instead of #numberOfItems.
This commit is contained in:
parent
6937d4c3be
commit
905d1106d4
2 changed files with 13 additions and 29 deletions
|
@ -46,7 +46,7 @@ var SvgImporter = this.SvgImporter = new function() {
|
|||
points = svg.points,
|
||||
start = points.getItem(0);
|
||||
poly.moveTo(start);
|
||||
for (var i = 1; i < points.length; i++)
|
||||
for (var i = 1, l = points.numberOfItems; i < l; i++)
|
||||
poly.lineTo(points.getItem(i));
|
||||
if (svg.nodeName.toLowerCase() == 'polygon')
|
||||
poly.closePath();
|
||||
|
|
|
@ -331,13 +331,9 @@ test('compare polygon values', function() {
|
|||
|
||||
var poly = new Path();
|
||||
var points = shape.points;
|
||||
var start = points.getItem(0);
|
||||
var point;
|
||||
poly.moveTo([start.x, start.y]);
|
||||
|
||||
for (var i = 1; i < points.length; i++) {
|
||||
point = points.getItem(i);
|
||||
poly.lineTo([point.x, point.y]);
|
||||
poly.moveTo(points.getItem(0));
|
||||
for (var i = 1; i < points.numberOfItems; i++) {
|
||||
poly.lineTo(points.getItem(i));
|
||||
}
|
||||
if (shape.nodeName.toLowerCase() == 'polygon') {
|
||||
poly.closePath();
|
||||
|
@ -356,13 +352,9 @@ test('compare negative polygon values', function() {
|
|||
|
||||
var poly = new Path();
|
||||
var points = shape.points;
|
||||
var start = points.getItem(0);
|
||||
var point;
|
||||
poly.moveTo([start.x, start.y]);
|
||||
|
||||
for (var i = 1; i < points.length; i++) {
|
||||
point = points.getItem(i);
|
||||
poly.lineTo([point.x, point.y]);
|
||||
poly.moveTo(points.getItem(0));
|
||||
for (var i = 1; i < points.numberOfItems; i++) {
|
||||
poly.lineTo(points.getItem(i));
|
||||
}
|
||||
if (shape.nodeName.toLowerCase() == 'polygon') {
|
||||
poly.closePath();
|
||||
|
@ -381,13 +373,9 @@ test('compare polyline values', function() {
|
|||
|
||||
var poly = new Path();
|
||||
var points = shape.points;
|
||||
var start = points.getItem(0);
|
||||
var point;
|
||||
poly.moveTo([start.x, start.y]);
|
||||
|
||||
for (var i = 1; i < points.length; i++) {
|
||||
point = points.getItem(i);
|
||||
poly.lineTo([point.x, point.y]);
|
||||
poly.moveTo(points.getItem(0));
|
||||
for (var i = 1; i < points.numberOfItems; i++) {
|
||||
poly.lineTo(points.getItem(i));
|
||||
}
|
||||
if (shape.nodeName.toLowerCase() == 'polygon') {
|
||||
poly.closePath();
|
||||
|
@ -406,13 +394,9 @@ test('compare negative polyline values', function() {
|
|||
|
||||
var poly = new Path();
|
||||
var points = shape.points;
|
||||
var start = points.getItem(0);
|
||||
var point;
|
||||
poly.moveTo([start.x, start.y]);
|
||||
|
||||
for (var i = 1; i < points.length; i++) {
|
||||
point = points.getItem(i);
|
||||
poly.lineTo([point.x, point.y]);
|
||||
poly.moveTo(points.getItem(0));
|
||||
for (var i = 1; i < points.numberOfItems; i++) {
|
||||
poly.lineTo(points.getItem(i));
|
||||
}
|
||||
if (shape.nodeName.toLowerCase() == 'polygon') {
|
||||
poly.closePath();
|
||||
|
|
Loading…
Reference in a new issue