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