Correctly set default anchor for collections

This commit is contained in:
Tim Schaub
2016-08-04 11:27:36 -06:00
parent 795cee876e
commit 69bf9254a5
4 changed files with 104 additions and 1 deletions
+31
View File
@@ -505,6 +505,37 @@ describe('ol.geom.Polygon', function() {
});
});
describe('#scale()', function() {
it('scales a polygon', function() {
var geom = new ol.geom.Polygon([
[[-1, -2], [1, -2], [1, 2], [-1, 2], [-1, -2]]
]);
geom.scale(10);
var coordinates = geom.getCoordinates();
expect(coordinates).to.eql([[[-10, -20], [10, -20], [10, 20], [-10, 20], [-10, -20]]]);
});
it('accepts sx and sy', function() {
var geom = new ol.geom.Polygon([
[[-1, -2], [1, -2], [1, 2], [-1, 2], [-1, -2]]
]);
geom.scale(2, 3);
var coordinates = geom.getCoordinates();
expect(coordinates).to.eql([[[-2, -6], [2, -6], [2, 6], [-2, 6], [-2, -6]]]);
});
it('accepts an anchor', function() {
var geom = new ol.geom.Polygon([
[[-1, -2], [1, -2], [1, 2], [-1, 2], [-1, -2]]
]);
geom.scale(3, 2, [-1, -2]);
var coordinates = geom.getCoordinates();
expect(coordinates).to.eql([[[-1, -2], [5, -2], [5, 6], [-1, 6], [-1, -2]]]);
});
});
describe('ol.geom.Polygon.fromExtent', function() {
it('creates the correct polygon', function() {
var extent = [1, 2, 3, 5];