opt_dest should be assigned to not pushed

This commit is contained in:
Björn Harrtell
2014-05-21 12:02:26 +02:00
parent 6ab92086d2
commit ce40a142fa
2 changed files with 10 additions and 1 deletions

View File

@@ -61,7 +61,8 @@ ol.geom.flat.interpolate.lineString =
} }
} }
if (goog.isDefAndNotNull(opt_dest)) { if (goog.isDefAndNotNull(opt_dest)) {
opt_dest.push(pointX, pointY); opt_dest[0] = pointX;
opt_dest[1] = pointY;
return opt_dest; return opt_dest;
} else { } else {
return [pointX, pointY]; return [pointX, pointY];

View File

@@ -42,6 +42,14 @@ describe('ol.geom.flat.interpolate', function() {
expect(point).to.eql([3, 4]); expect(point).to.eql([3, 4]);
}); });
it('returns the expected value when using opt_dest',
function() {
var flatCoordinates = [0, 1, 2, 3, 6, 7];
var point = ol.geom.flat.interpolate.lineString(
flatCoordinates, 0, 6, 2, 0.5, [0, 0]);
expect(point).to.eql([3, 4]);
});
}); });
}); });