The forEachLayerAtPixel method calls getDataAtPixel for each layer renderer

This commit is contained in:
Tim Schaub
2018-11-16 12:47:14 +01:00
parent 47ecd508fa
commit 3ecc6d60d2

View File

@@ -325,9 +325,9 @@ describe('ol.Map', function() {
beforeEach(function(done) {
log = [];
original = TileLayerRenderer.prototype.forEachLayerAtCoordinate;
TileLayerRenderer.prototype.forEachLayerAtCoordinate = function(coordinate) {
log.push(coordinate.slice());
original = TileLayerRenderer.prototype.getDataAtPixel;
TileLayerRenderer.prototype.getDataAtPixel = function(pixel) {
log.push(pixel.slice());
};
target = document.createElement('div');
@@ -364,13 +364,13 @@ describe('ol.Map', function() {
});
afterEach(function() {
TileLayerRenderer.prototype.forEachLayerAtCoordinate = original;
TileLayerRenderer.prototype.getDataAtPixel = original;
map.dispose();
document.body.removeChild(target);
log = null;
});
it('calls each layer renderer with the same coordinate', function() {
it('calls each layer renderer with the same pixel', function() {
const pixel = [10, 20];
map.forEachLayerAtPixel(pixel, function() {});
expect(log.length).to.equal(3);