Hi,<br><br>I&#39;m sorry, but I have a problem.<br><br>When I implement this, I can &quot;pan&quot; the map, and when I go over a marker, A popup appears, and when I go out of the marker, the popup disappear.<br><br>That&#39;s ok, but after the popup has appear an disappear, now I can not &quot;pan&quot; the map.<br>
Maybe the popup has deactivated something.<br>Can anyone help me?<br>Thanks<br>  Esteban Olm<br><br><br>after a popup is how<br><br><div class="gmail_quote">2009/8/5 Adrian Popa <span dir="ltr">&lt;<a href="mailto:adrian_gh.popa@romtelecom.ro">adrian_gh.popa@romtelecom.ro</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Following Alexandre&#39;s suggestion, here&#39;s what I did:<br>
<br>
... //in init()<br>
map.addLayer(markers);<br>
//add the main select (for regular popups)<br>
select = new OpenLayers.Control.SelectFeature(markers, {toggle:true,<br>
clickout: true});<br>
markers.events.on({ &quot;featureselected&quot;: onMarkerSelect,<br>
&quot;featureunselected&quot;: onMarkerUnselect});<br>
<br>
//add the second select for tooltips:<br>
var highlightCtrl = new OpenLayers.Control.SelectFeature(markers, {<br>
hover: true, highlightOnly: true, renderIntent: &quot;temporary&quot;,<br>
                    eventListeners: { featurehighlighted: tooltipSelect,<br>
featureunhighlighted: tooltipUnselect } });<br>
<br>
//the order in which you add these lines seems to matter!<br>
map.addControl(highlightCtrl);<br>
map.addControl(select);<br>
highlightCtrl.activate();<br>
select.activate();<br>
<br>
...//support functions<br>
var lastFeature = null;<br>
var tooltipPopup = null;<br>
<br>
function tooltipSelect(event){<br>
        var feature = event.feature;<br>
        var selectedFeature = feature;<br>
        //if there is already an opened details window, don\&#39;t draw the<br>
tooltip<br>
        if(feature.popup != null){<br>
            return;<br>
        }<br>
        //if there are other tooltips active, destroy them<br>
        if(tooltipPopup != null){<br>
            map.removePopup(tooltipPopup);<br>
            tooltipPopup.destroy();<br>
            if(lastFeature != null){<br>
                delete lastFeature.popup;<br>
                tooltipPopup = null;<br>
            }<br>
        }<br>
        lastFeature = feature;<br>
        var tooltipPopup = new OpenLayers.Popup(&quot;activetooltip&quot;,<br>
                    feature.geometry.getBounds().getCenterLonLat(),<br>
                    new OpenLayers.Size(80,12),<br>
                    &quot;&amp;nbsp;&quot;+<a href="http://feature.attributes.name" target="_blank">feature.attributes.name</a>,<br>
                    true );<br>
         //this is messy, but I&#39;m not a CSS guru<br>
        tooltipPopup.contentDiv.style.backgroundColor=&#39;ffffcb&#39;;<br>
        tooltipPopup.closeDiv.style.backgroundColor=&#39;ffffcb&#39;;<br>
        tooltipPopup.contentDiv.style.overflow=&#39;hidden&#39;;<br>
        tooltipPopup.contentDiv.style.padding=&#39;3px&#39;;<br>
        tooltipPopup.contentDiv.style.margin=&#39;0&#39;;<br>
        tooltipPopup.closeOnMove = true;<br>
        tooltipPopup.autoSize = true;<br>
        feature.popup = tooltipPopup;<br>
        map.addPopup(tooltipPopup);<br>
    }<br>
    function tooltipUnselect(event){<br>
        var feature = event.feature;<br>
        if(feature != null &amp;&amp; feature.popup != null){<br>
            map.removePopup(feature.popup);<br>
            feature.popup.destroy();<br>
            delete feature.popup;<br>
            tooltipPopup = null;<br>
            lastFeature = null;<br>
        }<br>
    }<br>
<br>
    function onMarkerSelect(event) {<br>
        //unselect any previous selections<br>
        tooltipUnselect(event);<br>
        var feature = event.feature;<br>
        var selectedFeature = feature;<br>
        var popup = new OpenLayers.Popup.FramedCloud(&quot;activeAlarm&quot;,<br>
                    feature.geometry.getBounds().getCenterLonLat(),<br>
                    new OpenLayers.Size(100,100),<br>
                    &quot;Loading...&lt;img<br>
src=&#39;http://$server/map/symbols/ajax-loader.gif&#39; border=0&gt;&quot;,<br>
                    null, true, onMarkerPopupClose );<br>
        feature.popup = popup;<br>
        popup.setOpacity(0.7);<br>
        map.addPopup(popup);<br>
        //call ajax to get the data<br>
        loadDetails(feature.attributes.description);<br>
    }<br>
    function onMarkerUnselect(event) {<br>
        var feature = event.feature;<br>
        if(feature.popup) {<br>
            map.removePopup(feature.popup);<br>
            feature.popup.destroy();<br>
            delete feature.popup;<br>
        }<br>
    }<br>
    function onMarkerPopupClose(evt) {<br>
        select.unselectAll();<br>
    }<br>
I hope this helps others trying to add this feature.<br>
<br>
Thanks again for your help.<br>
<br>
Regards,<br>
Adrian<br>
<br>
Alexandre Dube wrote:<br>
&gt; Hi Adrian,<br>
&gt;<br>
&gt;  Take a look at this example (1).  You can use 2 SelectFeature<br>
&gt; controls for what you need, one with hover:true and<br>
&gt; highlightOnly:true, the other with hover false.  The first one won&#39;t<br>
&gt; actually select the feature and you can register 3 kinds of<br>
&gt; &quot;highlight&quot; events (see the source) to display your small div/popup.<br>
&gt;<br>
&gt; Hope this helps,<br>
&gt;<br>
&gt; Alexandre<br>
&gt;<br>
&gt; (1) <a href="http://openlayers.org/dev/examples/highlight-feature.html" target="_blank">http://openlayers.org/dev/examples/highlight-feature.html</a><br>
&gt;<br>
&gt; Adrian Popa wrote:<br>
&gt;&gt; Hello everyone,<br>
&gt;&gt;<br>
&gt;&gt; This is sort of a repeat message of &quot;Re: [OpenLayers-Users]<br>
&gt;&gt; Labels/Tooltips on mouse over a Vector layer&quot; - but with a slightly<br>
&gt;&gt; different idea.<br>
&gt;&gt;<br>
&gt;&gt; Problem: I want to display a small div/popup with the marker&#39;s name<br>
&gt;&gt; when the user hovers his mouse over the location, and I want to<br>
&gt;&gt; display a bigger popup when the user actually clicks on the location.<br>
&gt;&gt;<br>
&gt;&gt; Current status:<br>
&gt;&gt; * I can use {hover: true} to register<br>
&gt;&gt; featureselected/featureunselected when I hover over a marker instead<br>
&gt;&gt; on when I click on the maker.<br>
&gt;&gt; * I haven&#39;t found any events that could differentiate between hover<br>
&gt;&gt; and click<br>
&gt;&gt;<br>
&gt;&gt; I&#39;m thinking I could register my select control with hover: true and<br>
&gt;&gt; allow featureselected to execute the same function for both when I<br>
&gt;&gt; click on the makrer as well as when I hover over the marker. I would<br>
&gt;&gt; like to know if there&#39;s any way to find out in the event inside the<br>
&gt;&gt; function if the user clicked or not his mouse. Depending on this, I<br>
&gt;&gt; would show one popup or the other.<br>
&gt;&gt;<br>
&gt;&gt; Something like:<br>
&gt;&gt;<br>
&gt;&gt; select = new OpenLayers.Control.SelectFeature(markers,<br>
&gt;&gt; {clickout:true, hover:true});<br>
&gt;&gt;         markers.events.on({ &quot;featureselected&quot;: onMarkerSelect,<br>
&gt;&gt; &quot;featureunselected&quot;: onMarkerUnselect, &quot;visibilitychanged&quot;:<br>
&gt;&gt; onMarkerToggle });<br>
&gt;&gt;         map.addControl(select);<br>
&gt;&gt;         select.activate();<br>
&gt;&gt;<br>
&gt;&gt; function onMarkerSelect(event){<br>
&gt;&gt;     var feature = event.feature;<br>
&gt;&gt;     //find out if the user clicked or not<br>
&gt;&gt;     var clicked = event.*findAWayToSeeIfTheUserClicked()*;<br>
&gt;&gt;     if(clicked){<br>
&gt;&gt;        //show larger popup<br>
&gt;&gt;     }<br>
&gt;&gt;     else{<br>
&gt;&gt;        //show smaller popup<br>
&gt;&gt;     }<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt; Suggestions are welcome.<br>
&gt;&gt;<br>
&gt;&gt; Thanks,<br>
&gt;&gt; Adrian<br>
&gt;&gt; ------------------------------------------------------------------------<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Users mailing list<br>
&gt;&gt; <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
&gt;&gt; <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
--<br>
---<br>
Adrian Popa<br>
NOC Division<br>
Network Engineer<br>
Divizia Centrul National de Operare Retea<br>
Departament Transport IP &amp; Metro<br>
Compartiment IP Core &amp; Backbone<br>
Phone: +40 21 400 3099<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
</blockquote></div><br>