Permalink
Browse files

Allow abort display a popup from a cluster with one element.

  • Loading branch information...
1 parent c921527 commit d7214b14639691f7ef310dbaa3dc98148b8f9854 @jorix committed Dec 29, 2012
Showing with 5 additions and 9 deletions.
  1. +1 −1 examples/feature-popups-plus.js
  2. +4 −8 lib/FeaturePopups.js
@@ -9,7 +9,7 @@ var singleEventListeners = {
"beforepopupdisplayed": function(e) {
var sel = e.selection;
// Use alert instead of a popup for poisLayer
- if (sel.layer === poisLayer) {
+ if (sel.layer === sundialsLayer) {
alert(sel.feature.id);
return false;
}
View
@@ -954,7 +954,6 @@ OpenLayers.Control.FeaturePopups = OpenLayers.Class(OpenLayers.Control, {
staticInvalid = false,
html = [],
countSelected = 0,
- sFeature0 = null,
allSelFeatures = [];
var layerObj, lenAux, r;
for (var layerId in this.layerObjs) {
@@ -976,9 +975,6 @@ OpenLayers.Control.FeaturePopups = OpenLayers.Class(OpenLayers.Control, {
});
lenAux = layerObj.layer.selectedFeatures.length;
countSelected += lenAux;
- if (lenAux === 1 && countSelected === 1) {
- sFeature0 = layerObj.layer.selectedFeatures[0];
- }
}
}
}
@@ -991,8 +987,8 @@ OpenLayers.Control.FeaturePopups = OpenLayers.Class(OpenLayers.Control, {
allSelFeatures[0].features.length === 1) {
var selObject = allSelFeatures[0],
feature = selObject.features[0];
- var rr = this.layerObjs[selObject.layer.id]
- .getSingleHtml(feature);
+ layerObj = selObject.layerObj;
+ var rr = layerObj.getSingleHtml(feature);
if (rr.hasTemplate) {
if (useCursorLocation &&
feature.geometry.getVertices().length > 1) {
@@ -1002,11 +998,11 @@ OpenLayers.Control.FeaturePopups = OpenLayers.Class(OpenLayers.Control, {
lonLat = feature.geometry.getBounds().getCenterLonLat();
}
this.popupObjs.single.showPopup({
- layerObj: selObject.layerObj,
+ layerObj: layerObj,
layer: layerObj.layer,
feature: feature
}, lonLat, rr.html, staticInvalid);
- response = !!this.popupObjs.single.popup;
+ response = true;
}
}
if (this.popupObjs.list && !response) {

0 comments on commit d7214b1

Please sign in to comment.