Do not ignore layer filter for unmanaged layers
PR #3883 made `forEachFeatureAtPixel` ignore unmanaged layers. This commit reverts that change.
This commit is contained in:
committed by
Andreas Hocevar
parent
6897e3cc52
commit
279eae1dba
@@ -161,29 +161,6 @@ describe('ol.interaction.Select', function() {
|
||||
describe('filter features using the filter option', function() {
|
||||
var select;
|
||||
|
||||
describe('with unmanaged layers', function() {
|
||||
it('does not call filter for unmanaged layers', function() {
|
||||
var spy = sinon.spy();
|
||||
var select = new ol.interaction.Select({
|
||||
multi: false,
|
||||
filter: spy
|
||||
});
|
||||
map.addInteraction(select);
|
||||
var feature = new ol.Feature(
|
||||
new ol.geom.Polygon([[[0, 0], [0, 40], [40, 40], [40, 0]]]));
|
||||
var unmanaged = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
features: [feature]
|
||||
})
|
||||
});
|
||||
unmanaged.setMap(map);
|
||||
map.renderSync();
|
||||
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
|
||||
expect(spy.getCalls().length).to.be(0);
|
||||
unmanaged.setMap(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with multi set to true', function() {
|
||||
|
||||
it('only selects features that pass the filter', function() {
|
||||
|
||||
@@ -55,12 +55,11 @@ describe('ol.renderer.canvas.Map', function() {
|
||||
expect(cb.firstCall.args[1]).to.be(layer);
|
||||
});
|
||||
|
||||
it('includes unmanaged layers, but calls callback with null', function() {
|
||||
it('calls callback with null for unmanaged layers', function() {
|
||||
layer.setMap(map);
|
||||
map.renderSync();
|
||||
var cb = sinon.spy();
|
||||
map.forEachFeatureAtPixel(map.getPixelFromCoordinate([0, 0]), cb, null,
|
||||
function() { return false; });
|
||||
map.forEachFeatureAtPixel(map.getPixelFromCoordinate([0, 0]), cb);
|
||||
expect(cb).to.be.called();
|
||||
expect(cb.firstCall.args[1]).to.be(null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user