Select the uppermost feature

This commit is contained in:
Frederic Junod
2015-02-10 09:59:09 +01:00
parent 776ffa925f
commit 13f265b4e1

View File

@@ -152,9 +152,8 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
function(feature, layer) {
selected.push(feature);
}, undefined, this.layerFilter_);
if (selected.length > 0 &&
features.getLength() == 1 &&
features.item(0) == selected[selected.length - 1]) {
if (selected.length > 0 && features.getLength() == 1 &&
features.item(0) == selected[0]) {
// No change
} else {
if (features.getLength() !== 0) {
@@ -163,7 +162,7 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
if (this.multi_) {
features.extend(selected);
} else if (selected.length > 0) {
features.push(selected[selected.length - 1]);
features.push(selected[0]);
}
}
} else {