[OpenLayers-Users] Re: hover selectFeature : keep selection until
new hover
snposm
oded_brod at yahoo.com
Tue Dec 6 11:11:21 EST 2011
Hello,
I did as Eric suggested and it worked! ,thanks a lot Eric! When I hover over
a feature a popup opens and remains open until I hover over a new feature
(then it closes and the new feature popup opens instead)
I would like to add another option where an opened popup also closes when I
click anywhere on the map area
any ideas how to do that?
thanks
Oded
P.S. here is my current code:
var last
var popup = new OpenLayers.Control.SelectFeature(vectorLayer,
{ hover: true,
highlightOnly: true,
renderIntent: "temporary",
callbacks: {
over: function(feature) {
destroyPopup(feature);
last=feature;
openPopup(feature);
},
out: function(feature) {}
}
}
);
function openPopup(feature){
last.popup = new OpenLayers.Popup.FramedCloud("pop",
feature.geometry.getBounds().getCenterLonLat(),
null,
'<div..... /div>
null,
true,
function() {destroyPopup(feature);}
);
last.popup.closeOnMove = true;
map.addPopup(last.popup);
};
function destroyPopup(feature) {
if(last!==null)
{
last.popup.destroy();
last= null;
}
};
map.addControl(popup);
popup.activate();
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/hover-selectFeature-keep-selection-until-new-hover-tp1827397p7067343.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list