[OpenLayers-Dev] Vector layer - Hover and click at same time
Ivan Grcic
ivan.grcic at geofoto.hr
Tue Jul 8 03:53:05 EDT 2008
Dear list,
I have one question about vector layer that I add on my map.
Everything works perfect, but i want to add some functionality and I
dont know if its possble to do it, because Im just getting deeper into
OL Controls, Events and Handlers system.
I load my vector data from GML source and show it on the map, then i
add some control for interacting with it.
What I want to do is change my vector objects style when i hover over
them, which is easy with renderIntent option.
var control = new OpenLayers.Control.SelectFeature(vectorLayer, {
hover: true,
clickout: false,
toggle: false,
multiple: false,
renderIntent:
OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style["select"]),
//onSelect: addPopup,
//onUnselect: removePopup
});
map.addControl(control);
control .activate();
And now comes the tricky part: besides hover over them and change
their color, I want to be able to add a popup on them when i click
them (not when i hover),
that usually works with onSelect and onUnselect params, but its not
possible to enable both options at the same time.
Also is not possible to add more SelectFeature controls on same layer, right?
Can somebody give me some hints/examples how to do this, if its possible at all.
Thank you,
Ivan
More information about the Dev
mailing list