Skip to content

Commit

Permalink
Select the uppermost feature
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj authored and tschaub committed Feb 13, 2015
1 parent e97f017 commit 4686dfc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ol/interaction/selectinteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down

0 comments on commit 4686dfc

Please sign in to comment.