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
@@ -170,6 +170,43 @@ describe('ol.geom.GeometryCollection', function() {
});
describe('#scale()', function() {
it('scales a collection', function() {
var geom = new ol.geom.GeometryCollection([
new ol.geom.Point([-1, -2]),
new ol.geom.LineString([[0, 0], [1, 2]])
]);
geom.scale(10);
var geometries = geom.getGeometries();
expect(geometries[0].getCoordinates()).to.eql([-10, -20]);
expect(geometries[1].getCoordinates()).to.eql([[0, 0], [10, 20]]);
});
it('accepts sx and sy', function() {
var geom = new ol.geom.GeometryCollection([
new ol.geom.Point([-1, -2]),
new ol.geom.LineString([[0, 0], [1, 2]])
]);
geom.scale(2, 3);
var geometries = geom.getGeometries();
expect(geometries[0].getCoordinates()).to.eql([-2, -6]);
expect(geometries[1].getCoordinates()).to.eql([[0, 0], [2, 6]]);
});
it('accepts an anchor', function() {
var geom = new ol.geom.GeometryCollection([
new ol.geom.Point([-1, -2]),
new ol.geom.LineString([[0, 0], [1, 2]])
]);
geom.scale(10, 15, [-1, -2]);
var geometries = geom.getGeometries();
expect(geometries[0].getCoordinates()).to.eql([-1, -2]);
expect(geometries[1].getCoordinates()).to.eql([[9, 28], [19, 58]]);
});
});
describe('#transform()', function() {
var line, multi, point;