diff options
author | etienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864> | 2009-01-18 14:35:19 +0000 |
---|---|---|
committer | etienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864> | 2009-01-18 14:35:19 +0000 |
commit | b332544e3748b43f36e666fb643cd6ff1c2c81fd (patch) | |
tree | 2ea25e037a113f7eb6f3d6200a5b978431a9148d /static/main_map.js | |
parent | 463993f6bfd47dd5e4b8c750e45b9e72912e3abb (diff) | |
download | Chimère-b332544e3748b43f36e666fb643cd6ff1c2c81fd.tar.bz2 Chimère-b332544e3748b43f36e666fb643cd6ff1c2c81fd.zip |
Improvement of management of click on the map
git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@20 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864
Diffstat (limited to 'static/main_map.js')
-rw-r--r-- | static/main_map.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/static/main_map.js b/static/main_map.js index 62a9f0d..5305495 100644 --- a/static/main_map.js +++ b/static/main_map.js @@ -64,6 +64,8 @@ function showPop(feature) { feature.popup.toggle(); } currentPopup = feature.popup; + /* hide on click on the cloud */ + currentPopup.groupDiv.onclick = hidePopUp; } /* check checked categories */ @@ -246,13 +248,21 @@ function putMarker(layer, mark) { document.body.style.cursor='auto'; OpenLayers.Event.stop(evt); }; - marker.events.register('mousedown', feature, markerClick); + marker.events.register('click', feature, markerClick); marker.events.register('mouseover', feature, markerOver); marker.events.register('mouseout', feature, markerOut); layer.addMarker(marker); return feature; } +var hidePopUp = function (evt) { + if (clicked) { + currentPopup.hide(); + clicked = false; + hide('detail'); + } +} + /* update current detail panel with an AJAX request */ function updateDetail(pk){ var uri = "/chimere/getDetail/" + pk; @@ -332,6 +342,9 @@ function init(){ permalink.div.childNodes[0].textContent = permalink_label; } map.addLayers([layerMapnik, cyclemap]); + + map.events.register('click', map, hidePopUp); + /* if from a permalink */ if (p_zoom) { var p_centerLonLat = new OpenLayers.LonLat(p_lon, p_lat); |