Permalink
Browse files

-nc

  • Loading branch information...
robengel
robengel committed Jul 7, 2011
1 parent 2dbc351 commit bb2af4b9b4b87d7e768aa1c23efa70d2cdeaf8c7
Showing with 30 additions and 2 deletions.
  1. +30 −2 geocamCover/static/geocamCover/app.js
@@ -43,6 +43,8 @@ var selectedView;
var myMarker;
var gpsDenied = false;
var markerCluster;
+var globalMap;
+var zoom = true;
var views = ["Task View", "Report View"];
@@ -53,6 +55,10 @@ $(window).resize(function() {
pageResize();
});
+function endZoom(){
+ zoom = false;
+}
+
$(document).ready(function () {
initiateGeolocation();
//setInterval("refreshGps()", 5000);
@@ -66,10 +72,16 @@ $(document).ready(function () {
'center': latlng,
'mapTypeId': google.maps.MapTypeId.ROADMAP,
'zoom': 12,
- 'callback': function () {
+ 'callback': function (map) {
+ globalMap = map;
$.getJSON('/geocamCover/places.json', function(data) {
markerCluster = new MarkerClusterer($('#map_canvas').gmap('getMap'), $('#map_canvas').gmap('getMarkers'));
- $.each(data.places, function(key, val) {
+
+ google.maps.event.addListener(markerCluster, "clusterclick", function (cluster) {
+ //TBD
+ });
+
+ $.each(data.places, function(key, val) {
var place = new Place();
latlng = new google.maps.LatLng(val.place.latitude, val.place.longitude);
place.id = val.place.id;
@@ -120,12 +132,28 @@ $(document).ready(function () {
//ADDING MARKERS WHEN THE USER CLICKS ON THE MAP
$('#map_canvas').bind('taphold', function(event) {
+ if (zoom)
+ return;
$('#place-form').show();
$('#categories-select').parent().find('.ui-btn-text').html("Select Category");
$('#dim').show();
clicked_position = event.latLng;
});
+ google.maps.event.addListener(globalMap, 'zoom_changed', function() {
+ zoom = true;
+ setTimeout(endZoom(), 1000);
+ });
+
+ google.maps.event.addListener(globalMap, 'drag', function() {
+ zoom = true;
+ });
+
+ google.maps.event.addListener(globalMap, 'dragend', function() {
+ zoom = false;
+ });
+
+
$("#place-form-form, #edit-place-page-form").submit(function(e) {
var place;

0 comments on commit bb2af4b

Please sign in to comment.