Merge pull request #4472 from ahocevar/layer-filter
Do not ignore layer filter for unmanaged layers
This commit is contained in:
@@ -283,7 +283,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
|
||||
* @param {ol.layer.Layer} layer Layer.
|
||||
*/
|
||||
function(feature, layer) {
|
||||
if (!layer || this.filter_(feature, layer)) {
|
||||
if (this.filter_(feature, layer)) {
|
||||
selected.push(feature);
|
||||
this.addFeatureLayerAssociation_(feature, layer);
|
||||
return !this.multi_;
|
||||
|
||||
@@ -153,11 +153,11 @@ ol.layer.Layer.prototype.handleSourcePropertyChange_ = function() {
|
||||
|
||||
|
||||
/**
|
||||
* Sets the layer to be rendered on a map. The map will not manage this layer in
|
||||
* its layers collection, layer filters in {@link ol.Map#forEachLayerAtPixel}
|
||||
* will not filter the layer, and it will be rendered on top. This is useful for
|
||||
* temporary layers. To remove an unmanaged layer from the map, use
|
||||
* `#setMap(null)`.
|
||||
* Sets the layer to be rendered on top of other layers on a map. The map will
|
||||
* not manage this layer in its layers collection, and the callback in
|
||||
* {@link ol.Map#forEachLayerAtPixel} will receive `null` as layer. This
|
||||
* is useful for temporary layers. To remove an unmanaged layer from the map,
|
||||
* use `#setMap(null)`.
|
||||
*
|
||||
* To add the layer to a map and have it managed by the map, use
|
||||
* {@link ol.Map#addLayer} instead.
|
||||
|
||||
@@ -167,9 +167,8 @@ ol.renderer.Map.prototype.forEachFeatureAtCoordinate =
|
||||
for (i = numLayers - 1; i >= 0; --i) {
|
||||
var layerState = layerStates[i];
|
||||
var layer = layerState.layer;
|
||||
if (!layerState.managed ||
|
||||
(ol.layer.Layer.visibleAtResolution(layerState, viewResolution) &&
|
||||
layerFilter.call(thisArg2, layer))) {
|
||||
if (ol.layer.Layer.visibleAtResolution(layerState, viewResolution) &&
|
||||
layerFilter.call(thisArg2, layer)) {
|
||||
var layerRenderer = this.getLayerRenderer(layer);
|
||||
if (layer.getSource()) {
|
||||
result = layerRenderer.forEachFeatureAtCoordinate(
|
||||
|
||||
Reference in New Issue
Block a user