From b332544e3748b43f36e666fb643cd6ff1c2c81fd Mon Sep 17 00:00:00 2001 From: etienne Date: Sun, 18 Jan 2009 14:35:19 +0000 Subject: Improvement of management of click on the map git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@20 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864 --- static/main_map.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'static') 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); -- cgit v1.2.3