Adrian Popa
Mon, 03 Aug 2009 00:54:30 -0700
Hello everyone,This is sort of a repeat message of "Re: [OpenLayers-Users] Labels/Tooltips on mouse over a Vector layer" - but with a slightly different idea.
Problem: I want to display a small div/popup with the marker's name when the user hovers his mouse over the location, and I want to display a bigger popup when the user actually clicks on the location.
Current status:* I can use {hover: true} to register featureselected/featureunselected when I hover over a marker instead on when I click on the maker. * I haven't found any events that could differentiate between hover and click
I'm thinking I could register my select control with hover: true and allow featureselected to execute the same function for both when I click on the makrer as well as when I hover over the marker. I would like to know if there's any way to find out in the event inside the function if the user clicked or not his mouse. Depending on this, I would show one popup or the other.
Something like:select = new OpenLayers.Control.SelectFeature(markers, {clickout:true, hover:true}); markers.events.on({ "featureselected": onMarkerSelect, "featureunselected": onMarkerUnselect, "visibilitychanged": onMarkerToggle });
map.addControl(select);
select.activate();
function onMarkerSelect(event){
var feature = event.feature;
//find out if the user clicked or not
var clicked = event.*findAWayToSeeIfTheUserClicked()*;
if(clicked){
//show larger popup
}
else{
//show smaller popup
}
}
Suggestions are welcome.
Thanks,
Adrian
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
[OpenLayers-Users] Displaying a popup on mouse over AND a different popup on click. Adrian Popa
- Re: [OpenLayers-Users] Displaying a popup on mouse over AND a different popup on click. Alexandre Dube
- Re: [OpenLayers-Users] Displaying a popup on mouse over AND a different popup on click. Adrian Popa
- Re: [OpenLayers-Users] Displaying a popup on mouse over AND a different popup on click. [SOLVED] Adrian Popa