The forEachLayerAtPixel method calls getDataAtPixel for each layer renderer
This commit is contained in:
@@ -325,9 +325,9 @@ describe('ol.Map', function() {
|
|||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
log = [];
|
log = [];
|
||||||
original = TileLayerRenderer.prototype.forEachLayerAtCoordinate;
|
original = TileLayerRenderer.prototype.getDataAtPixel;
|
||||||
TileLayerRenderer.prototype.forEachLayerAtCoordinate = function(coordinate) {
|
TileLayerRenderer.prototype.getDataAtPixel = function(pixel) {
|
||||||
log.push(coordinate.slice());
|
log.push(pixel.slice());
|
||||||
};
|
};
|
||||||
|
|
||||||
target = document.createElement('div');
|
target = document.createElement('div');
|
||||||
@@ -364,13 +364,13 @@ describe('ol.Map', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
TileLayerRenderer.prototype.forEachLayerAtCoordinate = original;
|
TileLayerRenderer.prototype.getDataAtPixel = original;
|
||||||
map.dispose();
|
map.dispose();
|
||||||
document.body.removeChild(target);
|
document.body.removeChild(target);
|
||||||
log = null;
|
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];
|
const pixel = [10, 20];
|
||||||
map.forEachLayerAtPixel(pixel, function() {});
|
map.forEachLayerAtPixel(pixel, function() {});
|
||||||
expect(log.length).to.equal(3);
|
expect(log.length).to.equal(3);
|
||||||
|
|||||||
Reference in New Issue
Block a user