Ignore layer filter for unmanaged layers
To make unmanaged vector layers work like the removed ol.FeatureOverlay, the layer filter for ol.Map#forEachFeatureAtPixel needs to ignore unmanaged layers.
This commit is contained in:
@@ -148,10 +148,13 @@ 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, and the layer will be rendered on top. 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.
|
||||
* 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)`.
|
||||
*
|
||||
* To add the layer to a map and have it managed by the map, use
|
||||
* {@link ol.Map#addLayer} instead.
|
||||
* @param {ol.Map} map Map.
|
||||
* @api
|
||||
*/
|
||||
|
||||
@@ -167,8 +167,9 @@ ol.renderer.Map.prototype.forEachFeatureAtCoordinate =
|
||||
for (i = numLayers - 1; i >= 0; --i) {
|
||||
var layerState = layerStates[i];
|
||||
var layer = layerState.layer;
|
||||
if (ol.layer.Layer.visibleAtResolution(layerState, viewResolution) &&
|
||||
layerFilter.call(thisArg2, layer)) {
|
||||
if (!layerState.managed ||
|
||||
(ol.layer.Layer.visibleAtResolution(layerState, viewResolution) &&
|
||||
layerFilter.call(thisArg2, layer))) {
|
||||
var layerRenderer = this.getLayerRenderer(layer);
|
||||
result = layerRenderer.forEachFeatureAtCoordinate(
|
||||
layer.getSource().getWrapX() ? translatedCoordinate : coordinate,
|
||||
|
||||
Reference in New Issue
Block a user