Created
February 8, 2011 23:15
-
-
Save dkobia/817507 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/application/views/main_js.php b/application/views/main_js.php | |
index 3cce2f9..f0ad38f 100644 | |
--- a/application/views/main_js.php | |
+++ b/application/views/main_js.php | |
@@ -40,6 +40,7 @@ | |
var defaultZoom = <?php echo $default_zoom; ?>; | |
var markerRadius = <?php echo $marker_radius; ?>; | |
var markerOpacity = "<?php echo $marker_opacity; ?>"; | |
+ var selectedFeature; | |
var activeZoom = null; | |
@@ -119,13 +120,9 @@ | |
/* | |
Close Popup | |
*/ | |
- function onPopupClose(evt) | |
+ function onPopupClose(event) | |
{ | |
- // selectControl.unselect(selectedFeature); | |
- for (var i=0; i<map.popups.length; ++i) | |
- { | |
- map.removePopup(map.popups[i]); | |
- } | |
+ selectControl.unselect(selectedFeature); | |
} | |
/* | |
@@ -133,10 +130,7 @@ | |
*/ | |
function onFeatureSelect(event) | |
{ | |
- selectedFeature = event; | |
- // Since KML is user-generated, do naive protection against | |
- // Javascript. | |
- | |
+ selectedFeature = event.feature; | |
zoom_point = event.feature.geometry.getBounds().getCenterLonLat(); | |
lon = zoom_point.lon; | |
lat = zoom_point.lat; | |
@@ -432,7 +426,9 @@ | |
//markers.setUrl("<?php echo url::site(); ?>" json_url + '/?c=' + catID); | |
// Destroy any open popups | |
- onPopupClose(); | |
+ if (selectedFeature) { | |
+ onPopupClose(); | |
+ }; | |
// Get Current Zoom | |
currZoom = map.getZoom(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment